Class: CommonConfig::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-app/common_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScope

Returns a new instance of Scope.



47
48
49
# File 'lib/ruby-app/common_config.rb', line 47

def initialize
  @configs = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *params, &block) ⇒ Object (private)



55
56
57
58
59
60
61
62
# File 'lib/ruby-app/common_config.rb', line 55

def method_missing(name, *params, &block)
  if name.to_s =~ /_address$/i
    @configs[name.to_sym] = block || RubyAppAddress.new(params[0], params[1].to_s)
  else
    params = params[0] if params.size == 1
    @configs[name.to_sym] = block || params
  end
end

Instance Attribute Details

#configsObject (readonly)

Returns the value of attribute configs.



51
52
53
# File 'lib/ruby-app/common_config.rb', line 51

def configs
  @configs
end