30 lines
492 B
Ruby
Raw Normal View History

2014-08-15 19:48:23 +07:00
module Burlesque
class Config
attr_accessor :host, :port, :timeout
def initialize
2014-08-16 14:39:10 +07:00
@host = '127.0.0.1'
2014-08-15 19:48:23 +07:00
@port = 4401
@timeout = 30
end
end
module Configurable
def configure
@config ||= Burlesque::Config.new
yield @config if block_given?
end
def config
unless instance_variable_defined?(:@config)
2014-08-16 14:39:10 +07:00
raise ConfigurationError.new('Configuration missing')
2014-08-15 19:48:23 +07:00
end
@config
end
end
extend Configurable
end