Class: Ifin24::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#configObject (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