class PinballWizard::DSL::Builder

Attributes

config[R]

Public Class Methods

new(config) click to toggle source
# File lib/pinball_wizard/dsl.rb, line 14
def initialize(config)
  @config = config
end

Public Instance Methods

feature(name, *options) click to toggle source
# File lib/pinball_wizard/dsl.rb, line 18
def feature(name, *options)
  options = Helpers::Hash.normalize_options(options)
  feature = build_feature(name, options)
  Registry.add(feature)
end

Private Instance Methods

build_feature(name, options) click to toggle source
# File lib/pinball_wizard/dsl.rb, line 26
def build_feature(name, options)
  build_from_class_pattern(name, options) || Feature.new(name, options)
end
build_from_class_pattern(name, options) click to toggle source
# File lib/pinball_wizard/dsl.rb, line 30
def build_from_class_pattern(name, options)
  config.class_patterns.each_pair do |key, klass|
    return klass.new(name, options) if options.keys.include?(key)
  end
  false
end