Skip to content

Commit

Permalink
use names
Browse files Browse the repository at this point in the history
  • Loading branch information
copiousfreetime committed May 3, 2024
1 parent b154574 commit fa472cd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/launchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ def app_for_name(name)
nil
end

def app_for_uri_string(s)
app_for_uri(string_to_uri(s))
def app_for_uri_string(str)
app_for_uri(string_to_uri(str))
end

def string_to_uri(s)
s = s.to_s
uri = Addressable::URI.parse(s)
Launchy.log "URI parsing pass 1 : #{s} -> #{uri.to_hash}"
def string_to_uri(str)
str = str.to_s
uri = Addressable::URI.parse(str)
Launchy.log "URI parsing pass 1 : #{str} -> #{uri.to_hash}"
if not uri.scheme then
uri = Addressable::URI.heuristic_parse(s)
Launchy.log "URI parsing pass 2 : #{s} -> #{uri.to_hash}"
uri = Addressable::URI.heuristic_parse(str)
Launchy.log "URI parsing pass 2 : #{str} -> #{uri.to_hash}"
end
raise Launchy::ArgumentError, "Invalid URI given: #{s.inspect}" unless uri
raise Launchy::ArgumentError, "Invalid URI given: #{str.inspect}" unless uri

return uri
end
Expand All @@ -97,8 +97,8 @@ def extract_global_options(options)
Launchy.dry_run = leftover.delete(:dry_run) || ENV["LAUNCHY_DRY_RUN"]
end

def debug=(d)
@debug = to_bool(d)
def debug=(enabled)
@debug = to_bool(enabled)
end

# we may do logging before a call to 'open', hence the need to check
Expand Down

0 comments on commit fa472cd

Please sign in to comment.