class YAMLSettings

Constants

VERSION

Public Class Methods

new(*filenames, key) click to toggle source

Settings are merged in two stages. First, all filenames are recursively merged in reverse order. Settings in succeeding filenames overwrite all duplicate settings in preceding filenames. Second, settings specified by key are then recursively merged with the default settings.

filenames

one or more YAML data files

key

selects the top-level stanza from filenames to be merged with the default stanza

Calls superclass method
# File lib/yaml_settings.rb, line 25
def initialize(*filenames, key)
  all_settings = filenames.collect {|f| YAML.load_file(f) }
  settings = all_settings.reduce {|i, j| deep_merge(i, j) }
  @settings = deep_merge(settings.fetch('default'),
                         settings.fetch(key.to_s))
  @settings.extend(AttrReader)
  propagate_attr_reader(@settings)
  super(@settings)
end

Public Instance Methods

inspect() click to toggle source
# File lib/yaml_settings.rb, line 35
def inspect() @settings.inspect end
Also aliased as: to_s
to_s()
Alias for: inspect