Class: Popper::Config
- Inherits:
-
Object
- Object
- Popper::Config
- Defined in:
- lib/popper/config.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
readonly
Returns the value of attribute accounts.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#global ⇒ Object
readonly
Returns the value of attribute global.
Instance Method Summary collapse
-
#initialize(config_path) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config_path) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/popper/config.rb', line 7 def initialize(config_path) raise "configure not fond #{config_path}" unless File.exist?(config_path) config = TOML.load_file(config_path) @global = AccountAttributes.new(config["global"]) if config["global"] @default = AccountAttributes.new(config["default"]) if config["default"] @accounts = [] config.select {|k,v| !%w(default global).include?(k) }.each do |account| _account = AccountAttributes.new(account[1]) _account.name = account[0] @accounts << _account end end |
Instance Attribute Details
#accounts ⇒ Object (readonly)
Returns the value of attribute accounts.
6 7 8 |
# File 'lib/popper/config.rb', line 6 def accounts @accounts end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
6 7 8 |
# File 'lib/popper/config.rb', line 6 def default @default end |
#global ⇒ Object (readonly)
Returns the value of attribute global.
6 7 8 |
# File 'lib/popper/config.rb', line 6 def global @global end |