Module: Dakwak::Configurable::Impl

Included in:
Dakwak::Configurable
Defined in:
lib/dakwak/configurable.rb

Instance Method Summary collapse

Instance Method Details

#set_option(k, v) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dakwak/configurable.rb', line 6

def set_option(k, v)
@cfg ||= {}

  # convert string keys to symbols
  if v.is_a?(Hash) then
    new_v = {}
    v.each_pair { |_k, _v| new_v[_k.to_sym] = v[_k] }
    v = new_v
  end

  @cfg[k.to_sym] = v
end