class Configurator::Parameter::Undefined
Undefined
is a parameter that was not set yet. It allows accessing its sub-parameters and defines the entire chain once an assignement method on a sub-parameter is called.
root
is where parameter will be ‘mounted’ on assignement name
is an Array of chained names starting from mount point
Public Class Methods
new( root, name, fullname )
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 77 def initialize( root, name, fullname ) # puts "Undefined.new: root=#{root} name=#{name.to_s} " @root = root @name = name # convert to array @fullname = fullname end
Public Instance Methods
defined?()
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 104 def defined?; false; end
empty?()
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 106 def empty?; true; end
method_missing(method, *args)
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 84 def method_missing(method, *args) param_name = method.to_s.match(METHOD_NAME_REGEXP)[1].to_sym # puts "Undefined.method_missing: #{method} root=#{@root} names=#{@names}" if method.to_s =~ /!$/ raise ArgumentError.new "Undefined parameter: #{@fullname}.#{param_name}" elsif method.to_s =~ /\?$/ false elsif method.to_s =~ /=$/ method = method.to_s.match(/^(.*)=$/)[1].to_sym # deep assign d = ( @root[@name.shift] ||= {} ) @name.each do |n| d = ( d[n] ||= {} ) end d[method] = args.first else Undefined.new( @root, @name+[method], "#{@fullname}.#{@name.shift}" ) end end
nil?()
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 105 def nil?; true; end
raw()
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 108 def raw; nil; end
to_ary()
click to toggle source
to_ary
defined basically to keep rspec happy
# File lib/aerogel/configurator/parameter.rb, line 111 def to_ary; []; end
to_s()
click to toggle source
# File lib/aerogel/configurator/parameter.rb, line 107 def to_s; ''; end