Class: Whistle::Config
- Inherits:
-
Object
- Object
- Whistle::Config
- Defined in:
- lib/config.rb
Constant Summary collapse
- SAMPLE =
File.join(File.dirname(__FILE__),'..','sample','config.yml')
Instance Attribute Summary collapse
-
#check ⇒ Object
readonly
Returns the value of attribute check.
-
#jabber ⇒ Object
readonly
Returns the value of attribute jabber.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relay ⇒ Object
readonly
Returns the value of attribute relay.
Instance Method Summary collapse
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
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
#check ⇒ Object (readonly)
Returns the value of attribute check.
7 8 9 |
# File 'lib/config.rb', line 7 def check @check end |
#jabber ⇒ Object (readonly)
Returns the value of attribute jabber.
7 8 9 |
# File 'lib/config.rb', line 7 def jabber @jabber end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/config.rb', line 7 def name @name end |
#relay ⇒ Object (readonly)
Returns the value of attribute relay.
7 8 9 |
# File 'lib/config.rb', line 7 def relay @relay end |