Class: OCG::Operator::OR
- Defined in:
- lib/ocg/operator/or.rb
Overview
OCG::Operator::OR class.
Constant Summary
Constants inherited from Abstract
Constants inherited from OCG
DELEGATORS, VARIABLES_TO_COPY, VERSION
Constants included from Copyable
Instance Method Summary collapse
-
#finished? ⇒ Boolean
Is option combinations generation finished?.
-
#last ⇒ Object
Get last option combination result.
-
#length ⇒ Object
Get option combinations length.
-
#next ⇒ Object
Get next option combination result.
-
#started? ⇒ Boolean
Is option combinations generation started?.
Methods inherited from Abstract
Methods inherited from OCG
#and, #each, #initialize, #mix, #or, prepare_generator
Methods included from Copyable
Constructor Details
This class inherits a constructor from OCG::Operator::Abstract
Instance Method Details
#finished? ⇒ Boolean
Is option combinations generation finished?
39 40 41 |
# File 'lib/ocg/operator/or.rb', line 39 def finished? @left_generator.finished? && @right_generator.finished? end |
#last ⇒ Object
Get last option combination result.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ocg/operator/or.rb', line 22 def last left = @left_generator.last right = @right_generator.last if right.nil? left else right end end |
#length ⇒ Object
Get option combinations length.
44 45 46 |
# File 'lib/ocg/operator/or.rb', line 44 def length @left_generator.length + @right_generator.length end |
#next ⇒ Object
Get next option combination result.
11 12 13 14 15 16 17 18 19 |
# File 'lib/ocg/operator/or.rb', line 11 def next return nil if finished? if @left_generator.finished? @right_generator.next else @left_generator.next end end |
#started? ⇒ Boolean
Is option combinations generation started?
34 35 36 |
# File 'lib/ocg/operator/or.rb', line 34 def started? @left_generator.started? || @right_generator.started? end |