Skip to content

Commit

Permalink
remove dependency on Rails for calling .to_query on hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Crews committed Feb 26, 2014
1 parent 78e169d commit 1278606
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/google_directions.rb
Expand Up @@ -96,3 +96,20 @@ def transcribe(location)
end

end

class Hash

def to_query
params = ''

each do |k, v|
params << "#{k}=#{v}&"
end

params.chop! # trailing &
params
end unless method_defined? :to_query

end


0 comments on commit 1278606

Please sign in to comment.