lib/reach.rb in wwood-reach-0.2.0 vs lib/reach.rb in wwood-reach-0.2.1

- old
+ new

@@ -45,11 +45,17 @@ # If this is an object-specific method, run an each on it. # A simple each won't work because that doesn't modify the # array elements in place as we want, so have to use collect # instead. @retract = @retract.collect do |o| - o.send(method, *args, &block) + unless o.kind_of?(Array) + o.send(method, *args, &block) + else + # Update in 0.2.1: If the element of the array is an array + # itself, then operate on it as a ReachingArray as well. + o.reach.send(method, *args, &block).retract + end end return self end end @@ -58,11 +64,11 @@ def ==(another) @retract <=> another.retract end def to_s - @retract.to_s + method_missing(:to_s) end def slap retract.slap end @@ -78,11 +84,17 @@ end # Try to pass the method to each of the array members def method_missing(method, *args, &block) @retract = @retract.collect do |o| - o.send(method, *args, &block) + unless o.kind_of?(Array) + o.send(method, *args, &block) + else + # Update in 0.2.1: If the element of the array is an array + # itself, then operate on it as a ReachingArray as well. + o.slap.send(method, *args, &block).retract + end end return self end # Equality test - equality of the underlying retract @@ -90,10 +102,10 @@ def ==(another) @retract <=> another.retract end def to_s - @retract.to_s + method_missing(:to_s) end def reach retract.reach end