Class: ArrayDecay::Enumerator
- Inherits:
-
Object
- Object
- ArrayDecay::Enumerator
- Includes:
- Enumerable
- Defined in:
- lib/array_decay.rb
Instance Attribute Summary collapse
-
#enumerator ⇒ Object
Returns the value of attribute enumerator.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(enumerator) ⇒ Enumerator
constructor
A new instance of Enumerator.
Constructor Details
#initialize(enumerator) ⇒ Enumerator
Returns a new instance of Enumerator.
15 16 17 |
# File 'lib/array_decay.rb', line 15 def initialize(enumerator) self.enumerator = enumerator end |
Instance Attribute Details
#enumerator ⇒ Object
Returns the value of attribute enumerator.
13 14 15 |
# File 'lib/array_decay.rb', line 13 def enumerator @enumerator end |
Instance Method Details
#each(&block) ⇒ Object
19 20 21 22 23 |
# File 'lib/array_decay.rb', line 19 def each(&block) until enumerator.empty? block.call(enumerator.shift) end end |