Module: Dizby::Configurable

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

Instance Method Summary collapse

Instance Method Details

#config_accessor(*args)


22
23
24
25
# File 'lib/dizby/utility/configurable.rb', line 22

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

#config_reader(*args)


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

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

#config_writer(*args)


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

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