class Config::Configuration

Public Class Methods

new() { |self| ... } click to toggle source

If block given, greate all instance variables @return [Configuration] self

# File lib/config.rb, line 51
def initialize
  yield(self) if block_given?
  return self
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source

Sets any un set instance variables

# File lib/config.rb, line 56
def method_missing(method, *args, &block)
  attr_name = method.to_s.gsub("=","")
  self.class.send(:attr_accessor, attr_name) ## Ensure accesor is set
  # ensure correct behavior if accesor was not set, hence method was missing
  if self.instance_variable_defined?("@#{attr_name}")
    self.instance_variable_get("@#{attr_name}")
  else
    self.instance_variable_set("@#{attr_name}", args.first)
  end
end