class OCG

Option combination generator. Copyright © 2019 AUTHORS, MIT License.

Option combination generator. Copyright © 2019 AUTHORS, MIT License.

OCG class.

Option combination generator. Copyright © 2019 AUTHORS, MIT License.

Constants

DELEGATORS

Current delegators.

VARIABLES_TO_COPY

Current variables to copy.

VERSION

Option combination generator version.

Public Class Methods

new(generator_or_options = {}) click to toggle source

Initializes options generator using generator_or_options. generator_or_options may be generator object or options. options is a hash with values convertable to array.

# File lib/ocg/main.rb, line 28
def initialize(generator_or_options = {})
  @generator = self.class.prepare_generator generator_or_options
end
prepare_generator(generator_or_options) click to toggle source

Prepares options generator using generator_or_options. generator_or_options may be generator object or options. options is a hash with values convertable to array.

# File lib/ocg/main.rb, line 35
def self.prepare_generator(generator_or_options)
  return generator_or_options if generator_or_options.is_a? OCG

  Options.new generator_or_options
end

Public Instance Methods

and(generator_or_options = {}) click to toggle source

Adds generator_or_options to current option combinations generator.

# File lib/ocg/main.rb, line 42
def and(generator_or_options = {})
  Operator::AND.new self, generator_or_options
end
each() { |next until finished?| ... } click to toggle source

Processes each option combination.

# File lib/ocg/main.rb, line 57
def each(&_block)
  instance = dup
  instance.reset

  yield instance.next until instance.finished?

  nil
end
mix(generator_or_options = {}) click to toggle source

Mixes generator_or_options with current option combinations generator.

# File lib/ocg/main.rb, line 47
def mix(generator_or_options = {})
  Operator::MIX.new self, generator_or_options
end
or(generator_or_options = {}) click to toggle source

Mixes generator_or_options with current option combinations generator.

# File lib/ocg/main.rb, line 52
def or(generator_or_options = {})
  Operator::OR.new self, generator_or_options
end