Class: Enumerator::Yielder
Instance Method Summary collapse
- #<<(*values) ⇒ Object
-
#initialize(&block) ⇒ Yielder
constructor
A new instance of Yielder.
- #yield(*values) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Yielder
Returns a new instance of Yielder
123 124 125 |
# File 'opal/opal/corelib/enumerator.rb', line 123 def initialize(&block) @block = block end |
Instance Method Details
#<<(*values) ⇒ Object
139 140 141 142 143 |
# File 'opal/opal/corelib/enumerator.rb', line 139 def <<(*values) self.yield(*values) self end |
#yield(*values) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 |
# File 'opal/opal/corelib/enumerator.rb', line 127 def yield(*values) %x{ var value = Opal.yieldX(#{@block}, values); if (value === $breaker) { throw $breaker; } return value; } end |