array-sorted 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,3 +10,7 @@ fixed SortedArray::Interface to include Array::Sorted::ArrayInterface
10
10
  == 6/30/2012
11
11
 
12
12
  Renamed from sorted-array to array-sorted. File schema updated to reflect gem name.
13
+
14
+ == 7/18/2012
15
+
16
+ Fix for sort-by block.
@@ -19,7 +19,7 @@ module ::Array::Sorted::ArrayInterface
19
19
  def initialize( configuration_instance = nil, *args, & sort_object_block )
20
20
 
21
21
  super( configuration_instance, *args )
22
-
22
+
23
23
  if block_given?
24
24
  @sort_object_block = sort_object_block
25
25
  end
@@ -99,11 +99,14 @@ module ::Array::Sorted::ArrayInterface
99
99
 
100
100
  def sort_by!( & block )
101
101
 
102
- return to_enum unless block_given?
102
+ if block_given?
103
+ @sort_object_block = block
104
+ else
105
+ return to_enum unless block_given?
106
+ end
103
107
 
104
108
  self.each do |this_member|
105
- sort_object = @sort_object_block ? @sort_object_block.call( this_member ) : this_member
106
- yield( sort_object )
109
+ @sort_object_block.call( this_member )
107
110
  end
108
111
 
109
112
  return self
@@ -179,8 +182,8 @@ module ::Array::Sorted::ArrayInterface
179
182
  existing_sort_object = this_member
180
183
 
181
184
  if @sort_object_block
182
- insert_sort_object = @sort_object_block.call( object )
183
- existing_sort_object = @sort_object_block.call( object )
185
+ insert_sort_object = @sort_object_block.call( insert_sort_object )
186
+ existing_sort_object = @sort_object_block.call( existing_sort_object )
184
187
  end
185
188
 
186
189
  if @sort_order_reversed
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: array-sorted
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: array-hooked
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ! '>='
56
56
  - !ruby/object:Gem::Version
57
- version: '0'
57
+ version: 1.9.1
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements: