Class: Lax
- Inherits:
-
Enumerator
- Object
- Enumerator
- Lax
- Defined in:
- lib/tzispa/utils/lax.rb
Instance Method Summary collapse
-
#initialize(receiver) ⇒ Lax
constructor
A new instance of Lax.
- #map(&block) ⇒ Object
- #take(n) ⇒ Object
Constructor Details
#initialize(receiver) ⇒ Lax
Returns a new instance of Lax.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tzispa/utils/lax.rb', line 9 def initialize(receiver) super() do |yielder| begin receiver.each do |val| if block_given? yield(yielder, val) else yielder << val end end rescue StopIteration end end end |