ohm-sorted 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/ohm/sorted.rb +3 -6
- data/ohm-sorted.gemspec +1 -1
- data/test/sorted_test.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2ViM2QyN2RiM2MxZjlkMmQzZmNiYjU5NTg3MDZiMDdiYmI2YWQyOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDQ3NTcwYTIwYmQzN2I4NDNiYjg4ODRjNmY3Y2NiNGQzMDI0NGU3MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWQ5N2FkODJhMjU2MGRlZDRhMGQxNWJiZmJjYmZmMmU1NjU1NWU4YmVkZWIw
|
10
|
+
OTkxMjU1NDZjMThkZWU1NTIwYjE1YzVlYzBkNmJiYWE5M2JjMTM2YzRlNTAz
|
11
|
+
MGI0ZjVlYjY5NzM4NjMyYjJiNjg4YjM4ZTg4YjNjMDlkZGNlN2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDUyMzI2YmZiYmUwYTZmNmNjYTJjNjliZTlmYTBhYzhlODY3YWYxOTM2MmEw
|
14
|
+
MDUyN2ViMjE1MTZkNmNkOThlNjQwZDJjYmI3Y2MzOGEzMGQzMWI5YjZiMTE4
|
15
|
+
YTI2ZDZkZmQ0MDgxMGE2NzI5NjVhYjkzNWM4ZmEyOGFjZDY4NmM=
|
data/CHANGELOG.md
CHANGED
data/lib/ohm/sorted.rb
CHANGED
@@ -105,12 +105,9 @@ module Ohm
|
|
105
105
|
model.db
|
106
106
|
end
|
107
107
|
|
108
|
-
def each
|
109
|
-
|
110
|
-
|
111
|
-
else
|
112
|
-
to_enum(:each)
|
113
|
-
end
|
108
|
+
def each(&block)
|
109
|
+
return to_enum(:each) unless block
|
110
|
+
ids.each { |id| block.call(model.to_proc[id]) }
|
114
111
|
end
|
115
112
|
|
116
113
|
def [](id)
|
data/ohm-sorted.gemspec
CHANGED
data/test/sorted_test.rb
CHANGED
@@ -198,7 +198,15 @@ class SortedTest < Test::Unit::TestCase
|
|
198
198
|
assert_equal posts[0..1], Post.sorted_find(:order).between(2, 3).reverse.to_a
|
199
199
|
end
|
200
200
|
|
201
|
-
def
|
201
|
+
def test_sorted_set_each
|
202
|
+
posts = []
|
203
|
+
|
204
|
+
posts << Post.create(order: 1)
|
205
|
+
|
206
|
+
Post.sorted_find(:order).each { |post| assert post.kind_of?(Post) }
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_sorted_set_each_returns_enumerable
|
202
210
|
assert Post.sorted_find(:order).each.kind_of?(Enumerator)
|
203
211
|
end
|
204
212
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm-sorted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Bond
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|