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
# File 'lib/things_fetcher/config.rb', line 7

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

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/things_fetcher/config.rb', line 12

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

#passwordObject



16
17
18
# File 'lib/things_fetcher/config.rb', line 16

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