Class: Hut::Config

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

Instance Method Summary collapse

Constructor Details

#initializeConfig

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

#accountObject



19
20
21
# File 'lib/hut/config.rb', line 19

def 
  @config[:account]
end

#config_pathObject



13
14
15
16
17
# File 'lib/hut/config.rb', line 13

def config_path
  if ENV['HOME'] && File.directory?(ENV['HOME'])
    File.expand_path '~/.hut'
  end
end

#roomsObject



27
28
29
# File 'lib/hut/config.rb', line 27

def rooms
  @config[:rooms]
end

#tokenObject



23
24
25
# File 'lib/hut/config.rb', line 23

def token
  @config[:token]
end