Class: Enumerator::Yielder

Inherits:
Object show all
Defined in:
mrbgems/mruby-enumerator/mrblib/enumerator.rb

Overview

just for internal

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Yielder

Returns a new instance of Yielder

Raises:


544
545
546
547
548
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 544

def initialize(&block)
  raise LocalJumpError, "no block given" unless block

  @proc = block
end

Instance Method Details

#<<(*args) ⇒ Object


554
555
556
557
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 554

def << *args
  self.yield(*args)
  self
end

#yield(*args) ⇒ Object


550
551
552
# File 'mrbgems/mruby-enumerator/mrblib/enumerator.rb', line 550

def yield(*args)
  @proc.call(*args)
end