Class: SlappingArray
- Inherits:
-
Object
- Object
- SlappingArray
- Defined in:
- lib/reach.rb
Instance Attribute Summary collapse
-
#retract ⇒ Object
The array that this reaching array is extending.
Instance Method Summary collapse
-
#==(another) ⇒ Object
Equality test - equality of the underlying retract arrays is all that matter.
-
#initialize(retract) ⇒ SlappingArray
constructor
A new instance of SlappingArray.
-
#method_missing(method, *args, &block) ⇒ Object
Try to pass the method to each of the array members.
- #reach ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(retract) ⇒ SlappingArray
Returns a new instance of SlappingArray.
76 77 78 |
# File 'lib/reach.rb', line 76 def initialize(retract) @retract = retract end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
Try to pass the method to each of the array members
81 82 83 84 85 86 |
# File 'lib/reach.rb', line 81 def method_missing(method, *args, &block) @retract = @retract.collect do |o| o.send(method, *args, &block) end return self end |
Instance Attribute Details
#retract ⇒ Object
The array that this reaching array is extending. This might be a real Array, or a ReachingArray
74 75 76 |
# File 'lib/reach.rb', line 74 def retract @retract end |
Instance Method Details
#==(another) ⇒ Object
Equality test - equality of the underlying retract arrays is all that matter
90 91 92 |
# File 'lib/reach.rb', line 90 def ==(another) @retract <=> another.retract end |
#reach ⇒ Object
98 99 100 |
# File 'lib/reach.rb', line 98 def reach retract.reach end |
#to_s ⇒ Object
94 95 96 |
# File 'lib/reach.rb', line 94 def to_s @retract.to_s end |