28 lines
419 B
Ruby
Raw Permalink 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
2014-08-16 15:24:35 +07:00
@config ||= Config.new
2014-08-15 19:48:23 +07:00
yield @config if block_given?
end
def config
2014-08-16 15:24:35 +07:00
configure unless instance_variable_defined?(:@config)
2014-08-15 19:48:23 +07:00
@config
end
end
extend Configurable
end