Class: RepoManager::Settings

Inherits:
Hash
  • Object
show all
Includes:
Extensions::MethodReader, Extensions::MethodWriter
Defined in:
lib/repo_manager/settings.rb

Overview

Access setting via symbolized keys or using accessor methods

Examples:


settings = Settings.new(FileUtils.pwd, {:config => 'some/file.yml'})

    verbose = settings.to_hash[:options] ? settings.to_hash[:options][:verbose] : false

 equivalent to:

    verbose = settings.options ? settings.options.verbose : false

Returns:

  • (Hash)

    , for pure hash use ‘to_hash’ instead

Instance Method Summary collapse

Methods included from Extensions::MethodWriter

#convert_key, #method_missing, #respond_to?

Methods included from Extensions::MethodReader

#method_missing, #respond_to?

Methods inherited from Hash

#deep_clone, #recursively_stringify_keys!, #recursively_symbolize_keys!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_conf

Constructor Details

#initialize(working_dir = nil, options = {}) ⇒ Settings

Returns a new instance of Settings.



25
26
27
28
29
30
31
32
33
# File 'lib/repo_manager/settings.rb', line 25

def initialize(working_dir=nil, options={})
  @working_dir = working_dir || FileUtils.pwd
  @configuration = configure(options.deep_clone)

  # call super without args
  super *[]

  self.merge!(@configuration)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RepoManager::Extensions::MethodWriter