Class: Enumerator::Yielder

Inherits:
Object
  • 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:



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