class RubyAPI::Config
Config
data
Public Class Methods
from_file(path)
click to toggle source
# File lib/ruby_api/config.rb, line 6 def self.from_file(path) new(YAML.load_file(path)) end
new(data)
click to toggle source
# File lib/ruby_api/config.rb, line 10 def initialize(data) @data = prep_data(data) end
Public Instance Methods
key?(key)
click to toggle source
# File lib/ruby_api/config.rb, line 18 def key?(key) @data.key?(key) end
merge!(data)
click to toggle source
# File lib/ruby_api/config.rb, line 14 def merge!(data) @data.merge! prep_data(data) end
method_missing(name, *args)
click to toggle source
Calls superclass method
# File lib/ruby_api/config.rb, line 26 def method_missing(name, *args) return @data[name.to_sym] if respond_to_missing?(name.to_sym) super end
respond_to_missing?(name, *)
click to toggle source
# File lib/ruby_api/config.rb, line 22 def respond_to_missing?(name, *) @data.key?(name) end
Private Instance Methods
prep_data(hash)
click to toggle source
# File lib/ruby_api/config.rb, line 33 def prep_data(hash) hash.deep_symbolize_keys! end