class Ruby2JS::OpalEnumerator
Opal's enumerator doesn't currently support next and peek methods. Build a wrapper that adds those methods.
Public Class Methods
new(stream)
click to toggle source
# File lib/ruby2js/jsx.rb, line 295 def initialize(stream) @stream = stream.to_a end
Public Instance Methods
next()
click to toggle source
# File lib/ruby2js/jsx.rb, line 299 def next raise StopIteration.new if @stream.empty? @stream.shift end
peek()
click to toggle source
# File lib/ruby2js/jsx.rb, line 304 def peek raise StopIteration.new if @stream.empty? @stream.first end