Class: Pik::ConfigFile
Instance Attribute Summary collapse
-
#global ⇒ Object
readonly
Returns the value of attribute global.
Instance Method Summary collapse
-
#initialize ⇒ ConfigFile
constructor
A new instance of ConfigFile.
- #write ⇒ Object
Methods inherited from Hash
Constructor Details
#initialize ⇒ ConfigFile
Returns a new instance of ConfigFile.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pik/config_file.rb', line 9 def initialize @file = File.join(PIK_HOME, 'config.yml') @global = {} super if File.exists? @file contents = File.read( @file ) unless contents.empty? documents = YAML.load_stream( contents ) self.update( documents[0] ) @global.update( documents[1] ) if documents[1] end end end |
Instance Attribute Details
#global ⇒ Object (readonly)
Returns the value of attribute global.
7 8 9 |
# File 'lib/pik/config_file.rb', line 7 def global @global end |