Class: I18n::Inflector::LazyEnumerator::Yielder
- Inherits:
-
Object
- Object
- I18n::Inflector::LazyEnumerator::Yielder
- Defined in:
- lib/i18n-inflector/lazy_enum.rb
Overview
This class allows to initialize the Enumerator with a block
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(&block) ⇒ Yielder
constructor
A new instance of Yielder.
- #yield(*arg) ⇒ Object (also: #<<)
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 |