Method: UserConfig::YAMLFile#initialize

Defined in:
lib/user_config.rb

#initialize(path, default, opts = {}) ⇒ YAMLFile

Returns a new instance of YAMLFile.

Parameters:

  • path (String)

    A path of yaml file, which saves pairs of key and value.

  • default (Hash)

    A hash saving default value.

  • opts (Hash) (defaults to: {})

    Options

Options Hash (opts):

  • If (booean)

    the value is true then values of an instance are merged with default values.



191
192
193
194
195
196
197
198
# File 'lib/user_config.rb', line 191

def initialize(path, default, opts = {})
  @path = path
  @default = default
  @cache = load_yaml_file
  if opts[:merge]
    @cache.merge!(@default)
  end
end