class OCG::Operator::MIX
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
OCG::Operator::Abstract::new
# File lib/ocg/operator/mix.rb, line 9 def initialize(*args) super reset_main_generator end
Public Instance Methods
finished?()
click to toggle source
# File lib/ocg/operator/mix.rb, line 51 def finished? @main_generator.finished? end
initialize_copy(*args)
click to toggle source
Calls superclass method
OCG::Copyable#initialize_copy
# File lib/ocg/operator/mix.rb, line 15 def initialize_copy(*args) super reset_main_generator end
last()
click to toggle source
# File lib/ocg/operator/mix.rb, line 38 def last left_last = @left_generator.last right_last = @right_generator.last return nil if left_last.nil? || right_last.nil? left_last.merge right_last end
length()
click to toggle source
# File lib/ocg/operator/mix.rb, line 55 def length @main_generator.length end
next()
click to toggle source
# File lib/ocg/operator/mix.rb, line 30 def next return nil if finished? @left_generator.reset if @left_generator.finished? @right_generator.reset if @right_generator.finished? @left_generator.next.merge @right_generator.next end
reset_main_generator()
click to toggle source
# File lib/ocg/operator/mix.rb, line 21 def reset_main_generator @main_generator = if @right_generator.length > @left_generator.length @right_generator else @left_generator end end
started?()
click to toggle source
# File lib/ocg/operator/mix.rb, line 47 def started? @main_generator.started? end