mongoid_spacial 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +28 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.md +126 -0
  6. data/Rakefile +42 -0
  7. data/VERSION +1 -0
  8. data/lib/mongoid_spacial.rb +11 -0
  9. data/lib/mongoid_spacial/contexts/mongo.rb +126 -0
  10. data/lib/mongoid_spacial/criteria.rb +5 -0
  11. data/lib/mongoid_spacial/criterion.rb +8 -0
  12. data/lib/mongoid_spacial/criterion/complex.rb +19 -0
  13. data/lib/mongoid_spacial/criterion/inclusion.rb +14 -0
  14. data/lib/mongoid_spacial/criterion/near_spacial.rb +43 -0
  15. data/lib/mongoid_spacial/criterion/within_spacial.rb +56 -0
  16. data/lib/mongoid_spacial/extentions/hash/criteria_helpers.rb +22 -0
  17. data/lib/mongoid_spacial/extentions/symbol/inflections.rb +46 -0
  18. data/lib/mongoid_spacial/field_option.rb +36 -0
  19. data/lib/mongoid_spacial/finders.rb +5 -0
  20. data/lib/mongoid_spacial/spacial.rb +37 -0
  21. data/lib/mongoid_spacial/spacial/core_ext.rb +27 -0
  22. data/lib/mongoid_spacial/spacial/document.rb +31 -0
  23. data/lib/mongoid_spacial/spacial/formulas.rb +47 -0
  24. data/mongoid_spacial.gemspec +172 -0
  25. data/spec/config/mongod.conf +3 -0
  26. data/spec/config/mongoid.yml +18 -0
  27. data/spec/functional/mongoid/contexts/mongo_spec.rb +101 -0
  28. data/spec/functional/mongoid/criterion/inclusion_spec.rb +356 -0
  29. data/spec/models/account.rb +19 -0
  30. data/spec/models/acolyte.rb +9 -0
  31. data/spec/models/address.rb +62 -0
  32. data/spec/models/address_component.rb +5 -0
  33. data/spec/models/agent.rb +10 -0
  34. data/spec/models/alert.rb +5 -0
  35. data/spec/models/animal.rb +21 -0
  36. data/spec/models/answer.rb +4 -0
  37. data/spec/models/bar.rb +9 -0
  38. data/spec/models/birthday.rb +13 -0
  39. data/spec/models/book.rb +5 -0
  40. data/spec/models/business.rb +7 -0
  41. data/spec/models/callbacks.rb +57 -0
  42. data/spec/models/category.rb +13 -0
  43. data/spec/models/circus.rb +7 -0
  44. data/spec/models/comment.rb +13 -0
  45. data/spec/models/country_code.rb +6 -0
  46. data/spec/models/description.rb +11 -0
  47. data/spec/models/division.rb +5 -0
  48. data/spec/models/drug.rb +5 -0
  49. data/spec/models/employer.rb +5 -0
  50. data/spec/models/entry.rb +6 -0
  51. data/spec/models/event.rb +20 -0
  52. data/spec/models/favorite.rb +6 -0
  53. data/spec/models/fruits.rb +11 -0
  54. data/spec/models/game.rb +18 -0
  55. data/spec/models/ghost.rb +7 -0
  56. data/spec/models/house.rb +4 -0
  57. data/spec/models/inheritance.rb +90 -0
  58. data/spec/models/league.rb +5 -0
  59. data/spec/models/location.rb +5 -0
  60. data/spec/models/login.rb +6 -0
  61. data/spec/models/membership.rb +4 -0
  62. data/spec/models/mixed_drink.rb +4 -0
  63. data/spec/models/name.rb +13 -0
  64. data/spec/models/namespacing.rb +11 -0
  65. data/spec/models/observed.rb +41 -0
  66. data/spec/models/override.rb +16 -0
  67. data/spec/models/owner.rb +6 -0
  68. data/spec/models/page.rb +5 -0
  69. data/spec/models/page_question.rb +4 -0
  70. data/spec/models/paranoid_post.rb +18 -0
  71. data/spec/models/parents.rb +32 -0
  72. data/spec/models/patient.rb +15 -0
  73. data/spec/models/person.rb +146 -0
  74. data/spec/models/pet.rb +7 -0
  75. data/spec/models/pet_owner.rb +6 -0
  76. data/spec/models/phone.rb +7 -0
  77. data/spec/models/player.rb +23 -0
  78. data/spec/models/post.rb +26 -0
  79. data/spec/models/preference.rb +9 -0
  80. data/spec/models/question.rb +8 -0
  81. data/spec/models/quiz.rb +6 -0
  82. data/spec/models/rating.rb +8 -0
  83. data/spec/models/river.rb +20 -0
  84. data/spec/models/role.rb +5 -0
  85. data/spec/models/service.rb +6 -0
  86. data/spec/models/shelf.rb +5 -0
  87. data/spec/models/slave_address_numbers.rb +14 -0
  88. data/spec/models/survey.rb +5 -0
  89. data/spec/models/tag.rb +6 -0
  90. data/spec/models/tracking_id_validation_history.rb +25 -0
  91. data/spec/models/translation.rb +5 -0
  92. data/spec/models/tree.rb +9 -0
  93. data/spec/models/user.rb +9 -0
  94. data/spec/models/user_account.rb +10 -0
  95. data/spec/models/vet_visit.rb +5 -0
  96. data/spec/models/video.rb +9 -0
  97. data/spec/models/wiki_page.rb +6 -0
  98. data/spec/spec_helper.rb +41 -0
  99. data/spec/support/authentication.rb +29 -0
  100. data/spec/unit/mongoid_spacial/criterion/complex_spec.rb +15 -0
  101. data/spec/unit/mongoid_spacial/criterion/inclusion_spec.rb +0 -0
  102. data/spec/unit/mongoid_spacial/criterion/near_spacial_spec.rb +39 -0
  103. data/spec/unit/mongoid_spacial/criterion/within_spacial_spec.rb +52 -0
  104. metadata +280 -0
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc:
3
+ module Criterion #:nodoc:
4
+
5
+ # WithinSpecial criterion is used when performing #within with symbols to get
6
+ # get a shorthand syntax for where clauses.
7
+ #
8
+ # @example Conversion of a simple to complex criterion.
9
+ # { :field => { "$within" => {'$center' => [20,30]} } }
10
+ # becomes:
11
+ # { :field.within(:center) => [20,30] }
12
+ class WithinSpacial < Complex
13
+
14
+ # Convert input to query for box, polygon, center, and centerSphere
15
+ #
16
+ # @example
17
+ # within = WithinSpacial.new(opts[:key] => 'point', :operator => 'center')
18
+ # within.to_mongo_query({:point => [20,30], :max => 5, :unit => :km}) #=>
19
+ #
20
+ # @param [Hash,Array] input Variable to conver to query
21
+ def to_mongo_query(input)
22
+ if ['box','polygon'].index(@operator)
23
+ input = input.values if input.kind_of?(Hash)
24
+ if input.respond_to?(:map)
25
+ input.map!{ |v| (v.respond_to?(:to_lng_lat)) ? v.to_lng_lat : v }
26
+ else
27
+ input
28
+ end
29
+ elsif ['center','centerSphere'].index(@operator)
30
+
31
+ if input.kind_of? Hash
32
+ if input[:point]
33
+ input[:point] = input[:point].to_lng_lat if input[:point].respond_to?(:to_lng_lat)
34
+ if input[:max]
35
+ unit = Mongoid::Spacial.earth_radius[input[:unit]]
36
+ input[:max] = input[:max]/unit if unit
37
+ input = [input[:point],input[:max]]
38
+ else
39
+ input = input[:point]
40
+ end
41
+ elsif RUBY_VERSION.to_f > 1.9
42
+ input = input.values
43
+ end
44
+ end
45
+
46
+ if input.kind_of? Array
47
+ input[0] = input[0].to_lng_lat if input[0].respond_to?(:to_lng_lat)
48
+ end
49
+
50
+ end
51
+ {'$within' => {"$#{@operator}"=>input} }
52
+ end
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc:
3
+ module Extensions #:nodoc:
4
+ module Hash #:nodoc:
5
+ module CriteriaHelpers #:nodoc:
6
+ def expand_complex_criteria
7
+ hsh = {}
8
+ each_pair do |k,v|
9
+ if k.respond_to?(:key) && k.respond_to?(:to_mongo_query)
10
+ hsh[k.key] ||= {}
11
+ hsh[k.key].merge!(k.to_mongo_query(v))
12
+ else
13
+ hsh[k] = v
14
+ end
15
+ end
16
+ hsh
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc:
3
+ module Extensions #:nodoc:
4
+ module Symbol #:nodoc:
5
+ module Inflections #:nodoc:
6
+
7
+ # return a class that will accept a value to convert the query correctly for near
8
+ #
9
+ # @param [Symbol] calc This accepts :sphere
10
+ #
11
+ # @return [Criterion::NearSpacial]
12
+
13
+ def near(calc = :flat)
14
+ Criterion::NearSpacial.new(:operator => get_op('near',calc), :key => self)
15
+ end
16
+
17
+ # alias for self.near(:sphere)
18
+ #
19
+ # @return [Criterion::NearSpacial]
20
+ def near_sphere
21
+ self.near(:sphere)
22
+ end
23
+
24
+ # @param [Symbol] shape :box,:polygon,:center,:center_sphere
25
+ #
26
+ # @return [Criterion::WithinSpacial]
27
+ def within(shape)
28
+ shape = get_op(:center,:sphere) if shape == :center_sphere
29
+ Criterion::WithinSpacial.new(:operator => shape.to_s , :key => self)
30
+ end
31
+
32
+ private
33
+
34
+ def get_op operator, calc
35
+ if calc.to_sym == :sphere && Mongoid.master.connection.server_version >= '1.7'
36
+ "#{operator}Sphere"
37
+ elsif calc.to_sym == :sphere
38
+ raise "MongoDB Server version #{Mongoid.master.connection.server_version} does not have Spherical Calculation"
39
+ else
40
+ operator.to_s
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,36 @@
1
+ require 'ostruct'
2
+ # Field changes to Fields from mongoid 2.0 to mongoid 2.1
3
+ field = (defined?(Mongoid::Field)) ? Mongoid::Field : Mongoid::Fields
4
+
5
+ field.option :spacial do |model,field,options|
6
+ options = {} unless options.kind_of?(Hash)
7
+ lat_meth = options[:lat] || "lat"
8
+ lng_meth = options[:lng] || "lng"
9
+ model.class_eval do
10
+ self.spacial_fields ||= []
11
+ self.spacial_fields << field.name.to_sym if self.spacial_fields.kind_of? Array
12
+
13
+ define_method "distance_from_#{field.name}" do |*args|
14
+ self.distance_from(field.name, *args)
15
+ end
16
+
17
+ define_method field.name do
18
+ output = self[field.name] || [nil,nil]
19
+ output = (options[:return_array]) ? lng_lat_a : {lng_meth => output[0], lat_meth => output[0]}
20
+ return options[:class].new(output) if options[:class]
21
+ output
22
+ end
23
+
24
+ define_method "#{field.name}=" do |arg|
25
+ if arg.kind_of?(Hash) && arg[lng_meth] && arg[lat_meth]
26
+ arg = [arg[lng_meth], arg[lat_meth]]
27
+ elsif arg.respond_to?(:to_lng_lat)
28
+ arg = arg.to_lat_lng if arg.respond_to?(:to_lat_lng)
29
+ end
30
+ self[field.name]=arg
31
+ return arg[0..1] if options[:return_array]
32
+ return h = {lng_meth => arg[0], lat_meth => arg[0]} if options[:class].blank?
33
+ options[:class].new(h)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Mongoid #:nodoc:
2
+ module Finders
3
+ delegate :geo_near, :to => :criteria
4
+ end
5
+ end
@@ -0,0 +1,37 @@
1
+ require 'mongoid_spacial/spacial/core_ext'
2
+ module Mongoid
3
+ module Spacial
4
+ autoload :Formulas, 'mongoid_spacial/spacial/formulas'
5
+ autoload :Document, 'mongoid_spacial/spacial/document'
6
+
7
+ EARTH_RADIUS_KM = 6371 # taken directly from mongodb
8
+
9
+ EARTH_RADIUS = {
10
+ :km => EARTH_RADIUS_KM,
11
+ :m => EARTH_RADIUS_KM*1000,
12
+ :mi => EARTH_RADIUS_KM*0.621371192, # taken directly from mongodb
13
+ :ft => EARTH_RADIUS_KM*5280*0.621371192,
14
+ }
15
+
16
+ LNG_SYMBOLS = [:x, :lon, :long, :lng, :longitude]
17
+ LAT_SYMBOLS = [:y, :lat, :latitude]
18
+
19
+ def distance(p1,p2,unit = nil, formula = nil)
20
+ formula ||= self.distance_formula
21
+ unit = earth_radius[unit] if unit.kind_of?(Symbol) && earth_radius[unit]
22
+ rads = Formulas.send(formula, p1, p2)
23
+ (unit.kind_of?(Numeric)) ? unit*rads : rads
24
+ end
25
+ mattr_accessor :lng_symbols
26
+ @@lng_symbols = LNG_SYMBOLS.dup
27
+
28
+ mattr_accessor :lat_symbols
29
+ @@lat_symbols = LAT_SYMBOLS.dup
30
+
31
+ mattr_accessor :earth_radius
32
+ @@earth_radius = EARTH_RADIUS.dup
33
+
34
+ mattr_accessor :distance_formula
35
+ @@distance_formula = :n_vector
36
+ end
37
+ end
@@ -0,0 +1,27 @@
1
+ class Array
2
+ def to_lng_lat
3
+ self[0..1].map(&:to_f)
4
+ end
5
+ end
6
+
7
+ class Hash
8
+ def to_lng_lat
9
+ raise "Hash must have at least 2 items" if self.size < 2
10
+ [to_lng, to_lat]
11
+ end
12
+
13
+ def to_lat
14
+ v = (Mongoid::Spacial.lat_symbols & self.keys).first
15
+ return self[v] if !v.nil? && self[v]
16
+ raise "Hash must contain #{Mongoid::Spacial.lat_symbols.inspect} if ruby version is less than 1.9" if RUBY_VERSION.to_f < 1.9
17
+ raise "Hash cannot contain #{Mongoid::Spacial.lng_symbols.inspect} as the second item if there is no #{Mongoid::Spacial.lat_symbols.inspect}" if Mongoid::Geo.lng_symbols.index(self.keys[1])
18
+ self.values[1]
19
+ end
20
+
21
+ def to_lng
22
+ v = (Mongoid::Spacial.lng_symbols & self.keys).first
23
+ return self[v] if !v.nil? && self[v]
24
+ raise "Hash cannot contain #{Mongoid::Spacial.lat_symbols.inspect} as the first item if there is no #{Mongoid::Spacial.lng_symbols.inspect}" if Mongoid::Geo.lat_symbols.index(self.keys[0])
25
+ self.values[0]
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ module Mongoid
2
+ module Spacial
3
+ module Document
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ attr_accessor :geo
8
+ cattr_accessor :spacial_fields, :spacial_fields_indexed
9
+ @@spacial_fields = []
10
+ @@spacial_fields_indexed = []
11
+ end
12
+
13
+ module ClassMethods #:nodoc:
14
+ # create spacial index for given field
15
+ # @param [String,Symbol] name
16
+ # @param [Hash] options options for spacial_index
17
+ def spacial_index name, *options
18
+ self.spacial_fields_indexed << name
19
+ index [[ name, Mongo::GEO2D ]], *options
20
+ end
21
+ end
22
+
23
+ module InstanceMethods #:nodoc:
24
+ def distance_from(key,center, unit = nil, formula = nil)
25
+ loc = res.send(key)
26
+ Mongoid::Spacial.distance(center, loc, unit, formula = nil)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,47 @@
1
+ module Mongoid
2
+ module Spacial
3
+ module Formulas
4
+ RAD_PER_DEG = 0.017453293
5
+
6
+ def n_vector(p1,p2)
7
+ sin_x1 = Math.sin(p1[0])
8
+ cos_x1 = Math.cos(p1[0])
9
+
10
+ sin_y1 = Math.sin(p1[1])
11
+ cos_y1 = Math.cos(p1[1])
12
+
13
+ sin_x2 = Math.sin(p2[0])
14
+ cos_x2 = Math.cos(p2[0])
15
+
16
+ sin_y2 = Math.sin(p2[1])
17
+ cos_y2 = Math.cos(p2[1])
18
+
19
+ cross_prod = (cos_y1*cos_x1 * cos_y2*cos_x2) +
20
+ (cos_y1*sin_x1 * cos_y2*sin_x2) +
21
+ (sin_y1 * sin_y2)
22
+ Math.acos(cross_prod)
23
+ end
24
+
25
+ def haversine(p1,p2)
26
+ lon1,lat1=p1
27
+ lon2,lat2=p2
28
+
29
+ dlon = lon2 - lon1
30
+ dlat = lat2 - lat1
31
+
32
+ dlon_rad = dlon * RAD_PER_DEG
33
+ dlat_rad = dlat * RAD_PER_DEG
34
+
35
+ lat1_rad = lat1 * RAD_PER_DEG
36
+ lon1_rad = lon1 * RAD_PER_DEG
37
+
38
+ lat2_rad = lat2 * RAD_PER_DEG
39
+ lon2_rad = lon2 * RAD_PER_DEG
40
+
41
+ a = (Math.sin(dlat_rad/2))**2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * (Math.sin(dlon_rad/2))**2
42
+
43
+ 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,172 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{mongoid_spacial}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Ryan Ong}]
12
+ s.date = %q{2011-06-22}
13
+ s.description = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
14
+ s.email = %q{ryanong@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/mongoid_spacial.rb",
28
+ "lib/mongoid_spacial/contexts/mongo.rb",
29
+ "lib/mongoid_spacial/criteria.rb",
30
+ "lib/mongoid_spacial/criterion.rb",
31
+ "lib/mongoid_spacial/criterion/complex.rb",
32
+ "lib/mongoid_spacial/criterion/inclusion.rb",
33
+ "lib/mongoid_spacial/criterion/near_spacial.rb",
34
+ "lib/mongoid_spacial/criterion/within_spacial.rb",
35
+ "lib/mongoid_spacial/extentions/hash/criteria_helpers.rb",
36
+ "lib/mongoid_spacial/extentions/symbol/inflections.rb",
37
+ "lib/mongoid_spacial/field_option.rb",
38
+ "lib/mongoid_spacial/finders.rb",
39
+ "lib/mongoid_spacial/spacial.rb",
40
+ "lib/mongoid_spacial/spacial/core_ext.rb",
41
+ "lib/mongoid_spacial/spacial/document.rb",
42
+ "lib/mongoid_spacial/spacial/formulas.rb",
43
+ "mongoid_spacial.gemspec",
44
+ "spec/config/mongod.conf",
45
+ "spec/config/mongoid.yml",
46
+ "spec/functional/mongoid/contexts/mongo_spec.rb",
47
+ "spec/functional/mongoid/criterion/inclusion_spec.rb",
48
+ "spec/models/account.rb",
49
+ "spec/models/acolyte.rb",
50
+ "spec/models/address.rb",
51
+ "spec/models/address_component.rb",
52
+ "spec/models/agent.rb",
53
+ "spec/models/alert.rb",
54
+ "spec/models/animal.rb",
55
+ "spec/models/answer.rb",
56
+ "spec/models/bar.rb",
57
+ "spec/models/birthday.rb",
58
+ "spec/models/book.rb",
59
+ "spec/models/business.rb",
60
+ "spec/models/callbacks.rb",
61
+ "spec/models/category.rb",
62
+ "spec/models/circus.rb",
63
+ "spec/models/comment.rb",
64
+ "spec/models/country_code.rb",
65
+ "spec/models/description.rb",
66
+ "spec/models/division.rb",
67
+ "spec/models/drug.rb",
68
+ "spec/models/employer.rb",
69
+ "spec/models/entry.rb",
70
+ "spec/models/event.rb",
71
+ "spec/models/favorite.rb",
72
+ "spec/models/fruits.rb",
73
+ "spec/models/game.rb",
74
+ "spec/models/ghost.rb",
75
+ "spec/models/house.rb",
76
+ "spec/models/inheritance.rb",
77
+ "spec/models/league.rb",
78
+ "spec/models/location.rb",
79
+ "spec/models/login.rb",
80
+ "spec/models/membership.rb",
81
+ "spec/models/mixed_drink.rb",
82
+ "spec/models/name.rb",
83
+ "spec/models/namespacing.rb",
84
+ "spec/models/observed.rb",
85
+ "spec/models/override.rb",
86
+ "spec/models/owner.rb",
87
+ "spec/models/page.rb",
88
+ "spec/models/page_question.rb",
89
+ "spec/models/paranoid_post.rb",
90
+ "spec/models/parents.rb",
91
+ "spec/models/patient.rb",
92
+ "spec/models/person.rb",
93
+ "spec/models/pet.rb",
94
+ "spec/models/pet_owner.rb",
95
+ "spec/models/phone.rb",
96
+ "spec/models/player.rb",
97
+ "spec/models/post.rb",
98
+ "spec/models/preference.rb",
99
+ "spec/models/question.rb",
100
+ "spec/models/quiz.rb",
101
+ "spec/models/rating.rb",
102
+ "spec/models/river.rb",
103
+ "spec/models/role.rb",
104
+ "spec/models/service.rb",
105
+ "spec/models/shelf.rb",
106
+ "spec/models/slave_address_numbers.rb",
107
+ "spec/models/survey.rb",
108
+ "spec/models/tag.rb",
109
+ "spec/models/tracking_id_validation_history.rb",
110
+ "spec/models/translation.rb",
111
+ "spec/models/tree.rb",
112
+ "spec/models/user.rb",
113
+ "spec/models/user_account.rb",
114
+ "spec/models/vet_visit.rb",
115
+ "spec/models/video.rb",
116
+ "spec/models/wiki_page.rb",
117
+ "spec/spec_helper.rb",
118
+ "spec/support/authentication.rb",
119
+ "spec/unit/mongoid_spacial/criterion/complex_spec.rb",
120
+ "spec/unit/mongoid_spacial/criterion/inclusion_spec.rb",
121
+ "spec/unit/mongoid_spacial/criterion/near_spacial_spec.rb",
122
+ "spec/unit/mongoid_spacial/criterion/within_spacial_spec.rb"
123
+ ]
124
+ s.homepage = %q{http://github.com/ryanong/mongoid_spacial}
125
+ s.licenses = [%q{MIT}]
126
+ s.require_paths = [%q{lib}]
127
+ s.rubygems_version = %q{1.8.5}
128
+ s.summary = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
129
+
130
+ if s.respond_to? :specification_version then
131
+ s.specification_version = 3
132
+
133
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
134
+ s.add_runtime_dependency(%q<mongoid>, [">= 0"])
135
+ s.add_runtime_dependency(%q<bson>, [">= 1.3"])
136
+ s.add_runtime_dependency(%q<bson_ext>, [">= 1.3"])
137
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
138
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
139
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
140
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
141
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
142
+ s.add_development_dependency(%q<rcov>, [">= 0"])
143
+ s.add_development_dependency(%q<linecache19>, [">= 0"])
144
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
145
+ else
146
+ s.add_dependency(%q<mongoid>, [">= 0"])
147
+ s.add_dependency(%q<bson>, [">= 1.3"])
148
+ s.add_dependency(%q<bson_ext>, [">= 1.3"])
149
+ s.add_dependency(%q<activesupport>, [">= 0"])
150
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
151
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
152
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
153
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
154
+ s.add_dependency(%q<rcov>, [">= 0"])
155
+ s.add_dependency(%q<linecache19>, [">= 0"])
156
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
157
+ end
158
+ else
159
+ s.add_dependency(%q<mongoid>, [">= 0"])
160
+ s.add_dependency(%q<bson>, [">= 1.3"])
161
+ s.add_dependency(%q<bson_ext>, [">= 1.3"])
162
+ s.add_dependency(%q<activesupport>, [">= 0"])
163
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
164
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
165
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
166
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
167
+ s.add_dependency(%q<rcov>, [">= 0"])
168
+ s.add_dependency(%q<linecache19>, [">= 0"])
169
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
170
+ end
171
+ end
172
+