Module: Panelbeater::Model

Included in:
Whm::Commands
Defined in:
lib/panelbeater/model.rb

Instance Method Summary collapse

Instance Method Details

#filter_options(hash) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/panelbeater/model.rb', line 14

def filter_options(hash)
  hash.each do |k,v|
    if v == true
      hash[k] = 1
    elsif v == false
      hash[k] = 0
    end
  end
  hash.delete_if {|k,v| v.nil? }
end

#key_mappings(map, hash) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/panelbeater/model.rb', line 4

def key_mappings(map, hash)
  map.each_key do |k|
    if hash.has_key? k
      hash[map[k]] = hash[k]
      hash.delete(k)
    end
  end
  hash
end