Class: Hut::Config
- Inherits:
-
Object
- Object
- Hut::Config
- Defined in:
- lib/hut/config.rb
Instance Method Summary collapse
- #account ⇒ Object
- #config_path ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #rooms ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 |
# File 'lib/hut/config.rb', line 5 def initialize if File.exists? config_path @config = YAML.load_file config_path else raise 'config must be provided at ~/.hut' end end |
Instance Method Details
#account ⇒ Object
19 20 21 |
# File 'lib/hut/config.rb', line 19 def account @config[:account] end |
#config_path ⇒ Object
13 14 15 16 17 |
# File 'lib/hut/config.rb', line 13 def config_path if ENV['HOME'] && File.directory?(ENV['HOME']) File. '~/.hut' end end |
#rooms ⇒ Object
27 28 29 |
# File 'lib/hut/config.rb', line 27 def rooms @config[:rooms] end |
#token ⇒ Object
23 24 25 |
# File 'lib/hut/config.rb', line 23 def token @config[:token] end |