ohm-sorted 0.3.2 → 0.3.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzM0ZTQ4YmIwNjYzYjUzNTlhOTQwYjgxNGVkNWRlYzhjMzJiNTFlMQ==
4
+ N2ViM2QyN2RiM2MxZjlkMmQzZmNiYjU5NTg3MDZiMDdiYmI2YWQyOA==
5
5
  data.tar.gz: !binary |-
6
- YWU4MmQ1MTU2ZjAwOGU4MTY2YTgwNmEwYmM3MDk5YmQxOTVjNmU2ZQ==
6
+ MDQ3NTcwYTIwYmQzN2I4NDNiYjg4ODRjNmY3Y2NiNGQzMDI0NGU3MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTNmZDhhMzlkNGMzOWZlMmE2ZTA4M2MxYWIwNDlhOWY4YzBhYWVlMzliYzlj
10
- ZjMwMGZiNTdjZDQ0ZjViYmQxOWQ4YmI1OWZiYmI5OTc2MTE4NGVlMzU2NzMx
11
- Y2JmMzNmYmJkMzY0MzBlNmQ2MDgxMjU5YjJkZjFlODdmOTQ2MGM=
9
+ YWQ5N2FkODJhMjU2MGRlZDRhMGQxNWJiZmJjYmZmMmU1NjU1NWU4YmVkZWIw
10
+ OTkxMjU1NDZjMThkZWU1NTIwYjE1YzVlYzBkNmJiYWE5M2JjMTM2YzRlNTAz
11
+ MGI0ZjVlYjY5NzM4NjMyYjJiNjg4YjM4ZTg4YjNjMDlkZGNlN2E=
12
12
  data.tar.gz: !binary |-
13
- MjM5NTYxMGQ0MjRmMjNkOGZlZjA2ODdlMWJiMzk2MTcyMjRhYmI0NDZlZThj
14
- NTI2MjY2YThjZThkMzdmNjQyNmM1MjEzOGMzMjIyZTQ4OTIzMzgzZDkwMGFm
15
- NDk4MDAzZjE3MmMwOTFlNzNjNDBhOWZlYzVhNDFkYzliYWZiNWM=
13
+ NDUyMzI2YmZiYmUwYTZmNmNjYTJjNjliZTlmYTBhYzhlODY3YWYxOTM2MmEw
14
+ MDUyN2ViMjE1MTZkNmNkOThlNjQwZDJjYmI3Y2MzOGEzMGQzMWI5YjZiMTE4
15
+ YTI2ZDZkZmQ0MDgxMGE2NzI5NjVhYjkzNWM4ZmEyOGFjZDY4NmM=
@@ -1,3 +1,7 @@
1
+ ### 0.3.3
2
+
3
+ - Fix broken `SortedSet#each` behavior
4
+
1
5
  ### 0.3.2
2
6
 
3
7
  - You can now use `SortedSet#reverse` to query in reverse order.
@@ -105,12 +105,9 @@ module Ohm
105
105
  model.db
106
106
  end
107
107
 
108
- def each
109
- if block_given?
110
- ids.each { |id| block.call(model.to_proc[id]) }
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)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ohm-sorted'
3
- s.version = '0.3.2'
3
+ s.version = '0.3.3'
4
4
  s.summary = "Sorted indices for Ohm."
5
5
  s.description = "An plugin for Ohm that lets you create sorted indices."
6
6
  s.author = "Federico Bond"
@@ -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 test_each_without_block_returns_enumerable
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.2
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-07 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal