Module: Formica

Defined in:
lib/formica.rb

Defined Under Namespace

Classes: Config, DSL, Option

Constant Summary collapse

VERSION =
File.read(File.expand_path('../VERSION', __dir__)).strip

Class Method Summary collapse

Class Method Details

.define_config(&blk) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/formica.rb', line 82

def self.define_config(&blk)
  dsl = DSL.new
  dsl.instance_exec(&blk)
  Class.new(Config) do
    class << self; attr_reader :options; end
    @options = dsl.options.each_with_object({}) { |o, h| h[o.attr_name] = o.freeze }.freeze

    options.each { |_, o| o.define_on(self) }

    validate_dependencies!
  end
end