class CampfireChat::Configuration

Attributes

pairs[R]
room[R]
subdomain[R]
token[R]

Public Class Methods

build(path = nil) click to toggle source
# File lib/campfire_chat/configuration.rb, line 6
def self.build(path = nil)
  path ||= Pathname.new(ENV['HOME']).join('.campfire.yml')
  new load_config(path)
end
load_config(path) click to toggle source
# File lib/campfire_chat/configuration.rb, line 11
def self.load_config(path)
  conf = YAML.load_file(path) || {}
  Hash[conf.map{ |k, v| [k.to_sym, v] }]
rescue Errno::ENOENT, TypeError
  {}
end
new(attrs={}) click to toggle source
# File lib/campfire_chat/configuration.rb, line 18
def initialize(attrs={})
  @token = attrs[:token]
  @subdomain = attrs[:subdomain]
  @room = attrs[:room]
  @pairs = []
end

Public Instance Methods

add_pair(name) click to toggle source
# File lib/campfire_chat/configuration.rb, line 25
def add_pair(name)
  pairs << CampfireChat::Engineer.new(:name => name)
end