Method: RightConf::Language#method_missing

Defined in:
lib/rconf/language.rb

#method_missing(meth, *args, &blk) ⇒ Object (protected)

Each missing method should correspond to a configurator section. Such sections consist of a block which gets eval’ed in the contect of the corresponding configurator instance.

Parameters

meth(Symbol)

Method symbol, should be a configurator

args(Array)

List of arguments

blk(Proc)

Block to be evaled in configurator context

Return

true

Always return true



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rconf/language.rb', line 72

def method_missing(meth, *args, &blk)
  if blk 
    klass = ConfiguratorRegistry[meth]
    if klass
      configurator = klass.new(*args)
      configurator.instance_eval(&blk)
      error = configurator.validate
      @validation_errors << error if error
      @configurators << configurator
    else
      @validation_errors << "Unknown configurator '#{meth}'"
    end
  else
    @validation_errors << "Invalid syntax, expecting block after '#{meth}'"
  end
  true
end