Class: Whistle::Config

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

Constant Summary collapse

SAMPLE =
File.join(File.dirname(__FILE__),'..','sample','config.yml')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



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

def initialize(path)
  @name = File.basename(path,'.yml')
  @config = YAML.load_file(path)
  @check = @config['check']
  @jabber = OpenStruct.new(@config['jabber'])
  if @config['relay']
    host, port = @config['relay'].split(/\:/)
    @relay = OpenStruct.new :host => host, :port => port
  end
end

Instance Attribute Details

#checkObject (readonly)

Returns the value of attribute check.



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

def check
  @check
end

#jabberObject (readonly)

Returns the value of attribute jabber.



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

def jabber
  @jabber
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#relayObject (readonly)

Returns the value of attribute relay.



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

def relay
  @relay
end