Class: Configural::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/configural/config.rb

Defined Under Namespace

Classes: FileBase, JSONFile, PlistFile, SDLFile, YAMLFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ Config

Returns a new instance of Config.



37
38
39
40
41
42
43
44
# File 'lib/configural/config.rb', line 37

def initialize( owner )
  @owner = owner
  @files = {}
  @options = {
    :default_format => 'yaml',
    :lazy_loading => false,
  }
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



35
36
37
# File 'lib/configural/config.rb', line 35

def options
  @options
end

#ownerObject

Returns the value of attribute owner.



35
36
37
# File 'lib/configural/config.rb', line 35

def owner
  @owner
end

Instance Method Details

#[](name) ⇒ Object



50
51
52
# File 'lib/configural/config.rb', line 50

def [](name)
  @files[name.to_s] ||= make_file(name.to_s)
end

#[]=(name, value) ⇒ Object



54
55
56
# File 'lib/configural/config.rb', line 54

def []=(name, value)
  @files[name.to_s] = value
end

#pathObject



46
47
48
# File 'lib/configural/config.rb', line 46

def path
  @owner.config_path
end

#save_allObject



58
59
60
61
# File 'lib/configural/config.rb', line 58

def save_all
  @files.each_value{ |file| file.save }
  self
end