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
137 138 139 |
# File 'opal/opal/corelib/enumerator.rb', line 137 def initialize(&block) @block = block end |
Instance Method Details
#<<(*values) ⇒ Object
153 154 155 156 157 |
# File 'opal/opal/corelib/enumerator.rb', line 153 def <<(*values) self.yield(*values) self end |
#yield(*values) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 |
# File 'opal/opal/corelib/enumerator.rb', line 141 def yield(*values) %x{ var value = Opal.yieldX(#@block, values); if (value === $breaker) { throw $breaker; } return value; } end |