mongoid_spacial 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ group :development do
13
13
  gem "bson_ext", '>= 1.3', :platforms => [:mri]
14
14
  gem "rspec", "~> 2.3.0"
15
15
  gem "yard", "~> 0.6.0"
16
- gem "bundler", "~> 1.0.0"
16
+ gem "bundler"
17
17
  gem "jeweler", "~> 1.6.2"
18
18
  gem "rcov", ">= 0"
19
19
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
@@ -76,7 +76,7 @@ module Mongoid #:nodoc:
76
76
  def create_geo_near_query(center,opts)
77
77
  # minimum query
78
78
  query = {
79
- :geoNear => klass.to_s.tableize,
79
+ :geoNear => klass.collection_name,
80
80
  :near => center,
81
81
  }
82
82
 
@@ -32,8 +32,7 @@ module Mongoid
32
32
  primary = @document.spacial_fields_indexed.first
33
33
  end
34
34
  @opts[:calculate].each do |key|
35
- key = (key.to_s+'_distance').to_sym
36
- res.geo[key] = res.distance_from(key,center,{:unit =>@opts[:unit] || @opts[:distance_multiplier], :spherical => @opts[:spherical]} )
35
+ res.geo[(key.to_s+'_distance').to_sym] = res.distance_from(key,center,{:unit =>@opts[:unit] || @opts[:distance_multiplier], :spherical => @opts[:spherical]} )
37
36
  res.geo[:distance] = res.geo[key] if primary && key == primary
38
37
  end
39
38
  end
@@ -91,6 +90,7 @@ module Mongoid
91
90
  def total_entries
92
91
  @opts[:total_entries]
93
92
  end
93
+ alias_method :total_count, :total_entries
94
94
 
95
95
  def current_page
96
96
  page = (@opts[:page]) ? @opts[:page].to_i.abs : 1
@@ -114,7 +114,7 @@ module Mongoid
114
114
  alias_method :per_page, :limit_value
115
115
 
116
116
  def num_pages
117
- @opts[:total_entries]/@opts[:per_page]
117
+ (self.total_entries && @opts[:per_page]) ? self.total_entries/@opts[:per_page] : nil
118
118
  end
119
119
  alias_method :total_pages, :num_pages
120
120
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid_spacial}
8
- s.version = "0.2.10"
8
+ s.version = "0.2.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Ryan Ong}]
12
- s.date = %q{2011-07-25}
12
+ s.date = %q{2011-08-11}
13
13
  s.description = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
14
14
  s.email = %q{ryanong@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -129,7 +129,7 @@ Gem::Specification.new do |s|
129
129
  s.homepage = %q{http://github.com/ryanong/mongoid_spacial}
130
130
  s.licenses = [%q{MIT}]
131
131
  s.require_paths = [%q{lib}]
132
- s.rubygems_version = %q{1.8.5}
132
+ s.rubygems_version = %q{1.8.6}
133
133
  s.summary = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
134
134
 
135
135
  if s.respond_to? :specification_version then
@@ -142,7 +142,7 @@ Gem::Specification.new do |s|
142
142
  s.add_development_dependency(%q<bson_ext>, [">= 1.3"])
143
143
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
144
144
  s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
145
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
145
+ s.add_development_dependency(%q<bundler>, [">= 0"])
146
146
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
147
147
  s.add_development_dependency(%q<rcov>, [">= 0"])
148
148
  s.add_development_dependency(%q<linecache19>, [">= 0"])
@@ -154,7 +154,7 @@ Gem::Specification.new do |s|
154
154
  s.add_dependency(%q<bson_ext>, [">= 1.3"])
155
155
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
156
156
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
157
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
157
+ s.add_dependency(%q<bundler>, [">= 0"])
158
158
  s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
159
159
  s.add_dependency(%q<rcov>, [">= 0"])
160
160
  s.add_dependency(%q<linecache19>, [">= 0"])
@@ -167,7 +167,7 @@ Gem::Specification.new do |s|
167
167
  s.add_dependency(%q<bson_ext>, [">= 1.3"])
168
168
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
169
169
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
170
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
170
+ s.add_dependency(%q<bundler>, [">= 0"])
171
171
  s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
172
172
  s.add_dependency(%q<rcov>, [">= 0"])
173
173
  s.add_dependency(%q<linecache19>, [">= 0"])
metadata CHANGED
@@ -1,148 +1,146 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mongoid_spacial
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.11
4
5
  prerelease:
5
- version: 0.2.10
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Ryan Ong
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-25 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: mongoid
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2159019380 !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *2159019380
25
+ - !ruby/object:Gem::Dependency
27
26
  name: activesupport
28
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &2159018780 !ruby/object:Gem::Requirement
29
28
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *2159018780
36
+ - !ruby/object:Gem::Dependency
38
37
  name: bson
39
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &2159018240 !ruby/object:Gem::Requirement
40
39
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "1.3"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '1.3'
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *2159018240
47
+ - !ruby/object:Gem::Dependency
49
48
  name: bson_ext
50
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &2159017700 !ruby/object:Gem::Requirement
51
50
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "1.3"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
56
55
  type: :development
57
56
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *2159017700
58
+ - !ruby/object:Gem::Dependency
60
59
  name: rspec
61
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &2159017060 !ruby/object:Gem::Requirement
62
61
  none: false
63
- requirements:
62
+ requirements:
64
63
  - - ~>
65
- - !ruby/object:Gem::Version
64
+ - !ruby/object:Gem::Version
66
65
  version: 2.3.0
67
66
  type: :development
68
67
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *2159017060
69
+ - !ruby/object:Gem::Dependency
71
70
  name: yard
72
- requirement: &id006 !ruby/object:Gem::Requirement
71
+ requirement: &2159016360 !ruby/object:Gem::Requirement
73
72
  none: false
74
- requirements:
73
+ requirements:
75
74
  - - ~>
76
- - !ruby/object:Gem::Version
75
+ - !ruby/object:Gem::Version
77
76
  version: 0.6.0
78
77
  type: :development
79
78
  prerelease: false
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
79
+ version_requirements: *2159016360
80
+ - !ruby/object:Gem::Dependency
82
81
  name: bundler
83
- requirement: &id007 !ruby/object:Gem::Requirement
82
+ requirement: &2159015760 !ruby/object:Gem::Requirement
84
83
  none: false
85
- requirements:
86
- - - ~>
87
- - !ruby/object:Gem::Version
88
- version: 1.0.0
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *id007
92
- - !ruby/object:Gem::Dependency
90
+ version_requirements: *2159015760
91
+ - !ruby/object:Gem::Dependency
93
92
  name: jeweler
94
- requirement: &id008 !ruby/object:Gem::Requirement
93
+ requirement: &2159015200 !ruby/object:Gem::Requirement
95
94
  none: false
96
- requirements:
95
+ requirements:
97
96
  - - ~>
98
- - !ruby/object:Gem::Version
97
+ - !ruby/object:Gem::Version
99
98
  version: 1.6.2
100
99
  type: :development
101
100
  prerelease: false
102
- version_requirements: *id008
103
- - !ruby/object:Gem::Dependency
101
+ version_requirements: *2159015200
102
+ - !ruby/object:Gem::Dependency
104
103
  name: rcov
105
- requirement: &id009 !ruby/object:Gem::Requirement
104
+ requirement: &2159014620 !ruby/object:Gem::Requirement
106
105
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: "0"
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
111
110
  type: :development
112
111
  prerelease: false
113
- version_requirements: *id009
114
- - !ruby/object:Gem::Dependency
112
+ version_requirements: *2159014620
113
+ - !ruby/object:Gem::Dependency
115
114
  name: linecache19
116
- requirement: &id010 !ruby/object:Gem::Requirement
115
+ requirement: &2159013920 !ruby/object:Gem::Requirement
117
116
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: "0"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
122
121
  type: :development
123
122
  prerelease: false
124
- version_requirements: *id010
125
- - !ruby/object:Gem::Dependency
123
+ version_requirements: *2159013920
124
+ - !ruby/object:Gem::Dependency
126
125
  name: ruby-debug19
127
- requirement: &id011 !ruby/object:Gem::Requirement
126
+ requirement: &2159007600 !ruby/object:Gem::Requirement
128
127
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: "0"
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
133
132
  type: :development
134
133
  prerelease: false
135
- version_requirements: *id011
136
- description: A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.
134
+ version_requirements: *2159007600
135
+ description: A Mongoid Extention that simplifies and adds support for MongoDB Geo
136
+ Spacial Calculations.
137
137
  email: ryanong@gmail.com
138
138
  executables: []
139
-
140
139
  extensions: []
141
-
142
- extra_rdoc_files:
140
+ extra_rdoc_files:
143
141
  - LICENSE.txt
144
142
  - README.md
145
- files:
143
+ files:
146
144
  - .document
147
145
  - .rspec
148
146
  - Gemfile
@@ -252,34 +250,32 @@ files:
252
250
  - spec/unit/mongoid/spacial/formulas_spec.rb
253
251
  - spec/unit/mongoid/spacial_spec.rb
254
252
  homepage: http://github.com/ryanong/mongoid_spacial
255
- licenses:
253
+ licenses:
256
254
  - MIT
257
255
  post_install_message:
258
256
  rdoc_options: []
259
-
260
- require_paths:
257
+ require_paths:
261
258
  - lib
262
- required_ruby_version: !ruby/object:Gem::Requirement
259
+ required_ruby_version: !ruby/object:Gem::Requirement
263
260
  none: false
264
- requirements:
265
- - - ">="
266
- - !ruby/object:Gem::Version
267
- hash: -4259724242028856304
268
- segments:
261
+ requirements:
262
+ - - ! '>='
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ segments:
269
266
  - 0
270
- version: "0"
271
- required_rubygems_version: !ruby/object:Gem::Requirement
267
+ hash: -3709962854313726421
268
+ required_rubygems_version: !ruby/object:Gem::Requirement
272
269
  none: false
273
- requirements:
274
- - - ">="
275
- - !ruby/object:Gem::Version
276
- version: "0"
270
+ requirements:
271
+ - - ! '>='
272
+ - !ruby/object:Gem::Version
273
+ version: '0'
277
274
  requirements: []
278
-
279
275
  rubyforge_project:
280
- rubygems_version: 1.8.5
276
+ rubygems_version: 1.8.6
281
277
  signing_key:
282
278
  specification_version: 3
283
- summary: A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.
279
+ summary: A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial
280
+ Calculations.
284
281
  test_files: []
285
-