Class: Mechmarket::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



7
8
9
10
11
12
13
14
15
# File 'lib/mechmarket/config.rb', line 7

def initialize
  config    = YAML.load_file("#{ENV['HOME']}/.mechmarket/mechmarket.yml")
  @username = config['username']
  @password = config['password']
  @queries  = config['queries']
rescue Errno::ENOENT => e
  puts 'Add your username, password and queries to $HOME/.mechmarket/mechmarket.yml.'
  raise e
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'lib/mechmarket/config.rb', line 5

def password
  @password
end

#queriesObject (readonly)

Returns the value of attribute queries.



5
6
7
# File 'lib/mechmarket/config.rb', line 5

def queries
  @queries
end

#usernameObject (readonly)

Returns the value of attribute username.



5
6
7
# File 'lib/mechmarket/config.rb', line 5

def username
  @username
end