Class: OCG::Operator::OR
Constant Summary
Constants inherited
from OCG
DELEGATORS, VERSION
Instance Method Summary
collapse
Methods inherited from Abstract
#initialize, #reset
Methods inherited from OCG
#and, #initialize, #mix, #or, prepare_generator, #to_a
Instance Method Details
#finished? ⇒ Boolean
34
35
36
|
# File 'lib/ocg/operator/or.rb', line 34
def finished?
@left_generator.finished? && @right_generator.finished?
end
|
#last ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/ocg/operator/or.rb', line 19
def last
left_last = @left_generator.last
right_last = @right_generator.last
if right_last.nil?
left_last
else
right_last
end
end
|
#length ⇒ Object
38
39
40
|
# File 'lib/ocg/operator/or.rb', line 38
def length
@left_generator.length + @right_generator.length
end
|
#next ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/ocg/operator/or.rb', line 9
def next
return nil if finished?
if @left_generator.finished?
@right_generator.next
else
@left_generator.next
end
end
|
#started? ⇒ Boolean
30
31
32
|
# File 'lib/ocg/operator/or.rb', line 30
def started?
@left_generator.started? || @right_generator.started?
end
|