Class: Proc::Enumerator
- Inherits:
-
Object
- Object
- Proc::Enumerator
- Includes:
- Enumerable
- Defined in:
- lib/proc/enumerator.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(values, &next_block) ⇒ Enumerator
constructor
A new instance of Enumerator.
Constructor Details
#initialize(values, &next_block) ⇒ Enumerator
Returns a new instance of Enumerator.
7 8 9 10 |
# File 'lib/proc/enumerator.rb', line 7 def initialize(values, &next_block) @values = values @next_block = next_block end |
Instance Method Details
#each(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/proc/enumerator.rb', line 12 def each(&block) return to_enum(:each) unless block @values.each(&block) if @next_block @next_block.call.each(&block) end end |