Class: Enumerator::Yielder
- Inherits:
-
Object
- Object
- Enumerator::Yielder
- Defined in:
- mrbgems/mruby-enumerator/mrblib/enumerator.rb
Overview
just for internal
Instance Method Summary collapse
-
#<<(*args) ⇒ Object
-
#initialize(&block) ⇒ Yielder
constructor
A new instance of Yielder.
-
#yield(*args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Yielder
Returns a new instance of Yielder
543 544 545 546 547 |
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 543 def initialize(&block) raise LocalJumpError, "no block given" unless block @proc = block end |
Instance Method Details
#<<(*args) ⇒ Object
553 554 555 556 |
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 553 def << *args self.yield(*args) self end |
#yield(*args) ⇒ Object
549 550 551 |
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 549 def yield(*args) @proc.call(*args) end |