Permalink
Browse files

Refactoring places method

  • Loading branch information...
1 parent 0eaafeb commit 481b4a49b8507a5b55261cc78097c2a1a4e07e8c @bryckbost bryckbost committed Dec 14, 2010
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/simple_geo/endpoint.rb
View
@@ -41,11 +41,15 @@ def context(lat, lon)
end
def places(lat, lon, options)
- params = ''
- options.each do |k,v|
- params << "#{k}=#{v}&"
- end if options
- endpoint_url "places/#{lat},#{lon}.json?#{params.chop!}"
+ if options.empty?
+ endpoint_url "places/#{lat},#{lon}.json"
+ else
+ params = ""
+ options.each do |k,v|
+ params << "#{k}=#{v}&"
+ end
+ endpoint_url "places/#{lat},#{lon}.json?#{params.chop!}"
+ end
end
def density(lat, lon, day, hour=nil)

0 comments on commit 481b4a4

Please sign in to comment.