Skip to content

Commit

Permalink
Refactoring Hash.to_query
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagolupepic committed Sep 11, 2014
1 parent a02778a commit 8e94e1e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/google_directions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,9 @@ def transcribe(location)
class Hash

def to_query
params = ''

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

params.chop! # trailing &
params
collect do |k, v|
"#{k}=#{v}"
end * '&'
end unless method_defined? :to_query

end
Expand Down

0 comments on commit 8e94e1e

Please sign in to comment.