mongoid-fts 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/mongoid-fts.rb +23 -2
- data/mongoid-fts.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTYzODIxZjUxMGVmN2QyMWI5MDNjMWMwNjViZTU3ZmI4ODFhMWJmOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzdjODk4YmY3MzA2NDJlYzQ3NDg3YTA1ZGRkNzczOTQyNmI0NWU4ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmQwZWZjMzFhZDVmMTIzZTc2MWY0ODM5MTA0ODA5YjM5M2QyMGE4ZjE1Mjcy
|
10
|
+
YWUxYTg2OTE2ZjkwNTVhZDk0M2EzMDY1MDViZDJjNzQwMWRjYWZhZjhkNGU2
|
11
|
+
ZTc1ZTI5MTUzZDVjYWQwNWUyZWRiOGE5ODNjYjI4ZDFjMmNlYzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2IyNWU2MjhlYjJhNGI2Y2Y2MDA5ZTQwMmMxMGNmMzBhZGZhNDUzMDNmNDU4
|
14
|
+
YWYwOTdjNjIyYzFlNDI0ODdmYTlmODQ4MGVhMTkyZWRkYWY3MWU3ZmIxMGFj
|
15
|
+
M2EwMzFjNDA4ODdmNmZlYmQxNDIzY2E2MTg0NDMxMWVmZTlmY2Q=
|
data/lib/mongoid-fts.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Mongoid
|
2
2
|
module FTS
|
3
3
|
#
|
4
|
-
const_set(:Version, '1.1.
|
4
|
+
const_set(:Version, '1.1.1') unless const_defined?(:Version)
|
5
5
|
|
6
6
|
class << FTS
|
7
7
|
def version
|
@@ -139,10 +139,17 @@ module Mongoid
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def paginate(*args)
|
142
|
+
results = self
|
142
143
|
options = Map.options_for!(args)
|
143
144
|
|
144
145
|
page = Integer(args.shift || options[:page] || @page)
|
145
|
-
per =
|
146
|
+
per = args.shift || options[:per] || options[:size]
|
147
|
+
|
148
|
+
if per.nil?
|
149
|
+
return Promise.new(results, page)
|
150
|
+
else
|
151
|
+
per = Integer(per)
|
152
|
+
end
|
146
153
|
|
147
154
|
@page = [page.abs, 1].max
|
148
155
|
@per = [per.abs, 1].max
|
@@ -158,6 +165,20 @@ module Mongoid
|
|
158
165
|
self
|
159
166
|
end
|
160
167
|
|
168
|
+
class Promise
|
169
|
+
attr_accessor :results
|
170
|
+
attr_accessor :page
|
171
|
+
|
172
|
+
def initialize(results, page)
|
173
|
+
@results = results
|
174
|
+
@page = page
|
175
|
+
end
|
176
|
+
|
177
|
+
def per(per)
|
178
|
+
results.per(:page => page, :per => per)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
161
182
|
def page(*args)
|
162
183
|
if args.empty?
|
163
184
|
return @page
|
data/mongoid-fts.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "mongoid-fts"
|
6
|
-
spec.version = "1.1.
|
6
|
+
spec.version = "1.1.1"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "mongoid-fts"
|
9
9
|
spec.description = "enable mongodb's new fulltext simply and quickly on your mongoid models, including pagination."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-fts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|