class EnvSettings::HashTree

Attributes

data[RW]

Public Class Methods

new(options ={}) click to toggle source
# File lib/env_settings/base.rb, line 5
def initialize options ={}
        @data = options
        @data.each do |k, v|
                if v.class == Hash && v.keys.length > 0
                        @data[k] = HashTree.new(v)
                end
        end
end

Public Instance Methods

[](key_name) click to toggle source
# File lib/env_settings/base.rb, line 22
def [](key_name)
        @data[key_name]
end
inspect() click to toggle source
# File lib/env_settings/base.rb, line 26
def inspect
        @data
end
method_missing(method, *args, &block) click to toggle source
# File lib/env_settings/base.rb, line 14
def method_missing(method, *args, &block)
        return @data[method] if @data[method]
        string_key = method.to_s
        return @data[string_key] if @data[string_key]
        return @data[string_key.to_i] if @data[string_key.to_i]
        raise "config data not contain key: #{method}"
end
to_s() click to toggle source
# File lib/env_settings/base.rb, line 30
def to_s
        @data.to_s
end