Class: M2Config::Setting

Inherits:
Object
  • Object
show all
Defined in:
lib/m2config/setting.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Setting

Returns a new instance of Setting.



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

def initialize( key, value )
  if s=Setting[key:key] 
    s.update({value:value})
    return s
  else
    fields = {}
    fields[:key] = key.to_s
    fields[:value] = value.to_s
    super(fields, false)
    save
    return self
  end
end