Module: Dizby::Configurable

Included in:
AbstractServer
Defined in:
lib/dizby/utility/configurable.rb

Instance Method Summary collapse

Instance Method Details

#config_accessor(*args)


20
21
22
23
# File 'lib/dizby/utility/configurable.rb', line 20

def config_accessor(*args)
  config_reader(*args)
  config_writer(*args)
end

#config_reader(*args)


4
5
6
7
8
9
10
# File 'lib/dizby/utility/configurable.rb', line 4

def config_reader(*args)
  args.each do |method|
    define_method(method) do
      instance_variable_get(:@config)[method]
    end
  end
end

#config_writer(*args)


12
13
14
15
16
17
18
# File 'lib/dizby/utility/configurable.rb', line 12

def config_writer(*args)
  args.each do |method|
    define_method("#{method}=") do |value|
      instance_variable_get(:@config)[method] = value
    end
  end
end