Class: ThingsFetcher::Config

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
# File 'lib/things_fetcher/config.rb', line 7

def initialize(path)
  super

  @data = default_config
  @data.merge! load_from_file(path)
end

Instance Method Details

#[](key) ⇒ Object



14
15
16
# File 'lib/things_fetcher/config.rb', line 14

def [](key)
  data.has_key?(key) ? data[key] : send(key.to_s)
end

#passwordObject



18
19
20
# File 'lib/things_fetcher/config.rb', line 18

def password
  KeyChain.find_internet_password '-s', data[:server], '-a', data[:username]
end