Sha256: 26ec29ffc4188b3d295447f2dabdfef1312c4a998330126c617a15cbe9b0c5cc

Contents?: true

Size: 535 Bytes

Versions: 2

Compression:

Stored size: 535 Bytes

Contents

require 'yaml'
require 'ostruct'

module Whistle
  class Config
    SAMPLE = File.join(File.dirname(__FILE__),'..','sample','config.yml')
    attr_reader :check, :jabber, :name, :relay
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whistle-0.1.1 lib/config.rb
whistle-0.1 lib/config.rb