class EAAL::Config

Public Class Methods

new(data={}) click to toggle source
# File lib/eaal/config.rb, line 4
def initialize(data={})
  @data = {}
  update!(data)
end

Public Instance Methods

[](key) click to toggle source
# File lib/eaal/config.rb, line 15
def [](key)
  @data[key.to_sym]
end
[]=(key, value) click to toggle source
# File lib/eaal/config.rb, line 19
def []=(key, value)
  if value.class == Hash
    @data[key.to_sym] = Config.new(value)
  else
    @data[key.to_sym] = value
  end
end
method_missing(sym, *args) click to toggle source
# File lib/eaal/config.rb, line 27
def method_missing(sym, *args)
  if sym.to_s =~ /(.+)=$/
    self[$1] = args.first
  else
    self[sym]
  end
end
update!(data) click to toggle source
# File lib/eaal/config.rb, line 9
def update!(data)
  data.each do |key, value|
    self[key] = value
  end
end