Class: Buddhy::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



6
7
8
# File 'lib/buddhy/config.rb', line 6

def channel
  @channel
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/buddhy/config.rb', line 6

def name
  @name
end

#nickObject

Returns the value of attribute nick.



6
7
8
# File 'lib/buddhy/config.rb', line 6

def nick
  @nick
end

#serverObject

Returns the value of attribute server.



6
7
8
# File 'lib/buddhy/config.rb', line 6

def server
  @server
end

Class Method Details

.loadObject



8
9
10
# File 'lib/buddhy/config.rb', line 8

def self.load
  new.read_yaml
end

Instance Method Details

#read_yamlObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/buddhy/config.rb', line 12

def read_yaml
  root = File.expand_path('../../..', __FILE__)
  file = File.join(root, 'config', 'buddhy.yml')
  hash = YAML.load(File.read(file))

  @nick    = hash[:nick]
  @name    = hash[:name]
  @server  = hash[:server]
  @channel = hash[:channel]

  self
end