Module: Plato::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/plato/config.rb

Instance Method Summary collapse

Instance Method Details

#read(dsl_class, string = nil, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/plato/config.rb', line 5

def read(dsl_class, string = nil, &block)
  config = dsl_class.new

  if string
    config.instance_eval(string)
  else
    block.arity == 1 ? call.block(config) : config.instance_eval(&block)
  end

  extract_ivars(config)
end