Module: Configure

Defined in:
lib/configure.rb

Defined Under Namespace

Modules: Schema Classes: Checker, Injector, InvalidKeyError, NilValueError, Sandbox, Value

Class Method Summary collapse

Class Method Details

.process(schema = nil, &block) ⇒ Object



16
17
18
19
# File 'lib/configure.rb', line 16

def self.process(schema = nil, &block)
  schema ||= Schema.build { }
  process_configuration schema, &block
end

.process_configuration(schema = { }, &block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/configure.rb', line 21

def self.process_configuration(schema = { }, &block)
  injector = Injector.new schema
  Sandbox.new(injector).instance_eval &block
  configuration = injector.configuration
  Checker.new(schema, configuration).check!
  configuration
end