Class: Mechmarket::Config
- Inherits:
-
Object
- Object
- Mechmarket::Config
- Defined in:
- lib/mechmarket/config.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#queries ⇒ Object
readonly
Returns the value of attribute queries.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
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
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/mechmarket/config.rb', line 5 def password @password end |
#queries ⇒ Object (readonly)
Returns the value of attribute queries.
5 6 7 |
# File 'lib/mechmarket/config.rb', line 5 def queries @queries end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/mechmarket/config.rb', line 5 def username @username end |