Permalink
Browse files

add geokit dependency to Rakefile. rename methods. initial gem release.

  • Loading branch information...
1 parent b06d558 commit c34186a0dc6cf2feb4a7921afc9f4ca4d4a2d5df @netskin-ci netskin-ci committed Aug 31, 2010
Showing with 4 additions and 3 deletions.
  1. +1 −0 Rakefile
  2. +3 −3 lib/sequel_mappable.rb
View
@@ -11,6 +11,7 @@ begin
gem.homepage = 'http://github.com/gucki/sequel_mappable'
gem.summary = 'Usefull geo data filters for Sequel'
gem.description = 'Sequel plugin which provides geo distance-based filters and distance calculation functionality for model.'
+ gem.add_dependency "geokit", ">= 1.5.0"
gem.add_development_dependency "rspec", ">= 1.2.9"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
@@ -43,7 +43,7 @@ module InstanceMethods
end
module DatasetMethods
- def bounded_location(origin, within)
+ def f_origin_bbox(origin, within)
bounds = Geokit::Bounds.from_point_and_radius(origin, within, :units => :kms)
sw, ne = bounds.sw, bounds.ne
filter = self
@@ -55,9 +55,9 @@ def bounded_location(origin, within)
filter.filter{(lat < ne.lat) & (lat > sw.lat)}
end
- def area(origin, within)
+ def f_origin(origin, within)
sql = model.distance_sql(origin)
- bounded_location(origin, within).filter{sql.lit <= within}
+ f_origin_bbox(origin, within).filter{sql.lit <= within}
end
end
end

0 comments on commit c34186a

Please sign in to comment.