Class: I18n::Inflector::LazyEnumerator::Yielder

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n-inflector/lazy_enum.rb

Overview

This class allows to initialize the Enumerator with a block

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Yielder

Returns a new instance of Yielder.



19
20
21
# File 'lib/i18n-inflector/lazy_enum.rb', line 19

def initialize(&block)
  @main_block = block
end

Instance Method Details

#each(&block) ⇒ Object



23
24
25
26
# File 'lib/i18n-inflector/lazy_enum.rb', line 23

def each(&block)
  @final_block = block
  @main_block.call(self)
end

#yield(*arg) ⇒ Object Also known as: <<



29
30
31
# File 'lib/i18n-inflector/lazy_enum.rb', line 29

def yield(*arg)
  @final_block.yield(*arg)
end