Class: Ifin24::Configuration
- Inherits:
-
Object
- Object
- Ifin24::Configuration
- Includes:
- Singleton
- Defined in:
- lib/ifin24/configuration.rb
Constant Summary collapse
- CONFIG_FILE_NAME =
File.join(ENV['HOME'], '.ifin24-client', 'config.yml')
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 |
# File 'lib/ifin24/configuration.rb', line 11 def initialize @config = {} if File.exist?(CONFIG_FILE_NAME) @config = YAML.load_file(CONFIG_FILE_NAME) rescue {} end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/ifin24/configuration.rb', line 9 def config @config end |
Instance Method Details
#[](index) ⇒ Object
19 20 21 |
# File 'lib/ifin24/configuration.rb', line 19 def [](index) @config[index] end |