Class: Hash

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

Instance Method Summary collapse

Instance Method Details

#rzbx_recursively_symbolize_keysObject



22
23
24
25
26
27
28
29
30
# File 'lib/rzabbix.rb', line 22

def rzbx_recursively_symbolize_keys
  result = self.rzbx_symbolize_keys
  result.keys.each do |key|
    if result[key].is_a?(Hash) || result[key].is_a?(Array)
      result[key] = result[key].rzbx_recursively_symbolize_keys
    end
  end
  result
end

#rzbx_symbolize_keysObject



14
15
16
17
18
19
# File 'lib/rzabbix.rb', line 14

def rzbx_symbolize_keys
  inject({}) do |options, (key, value)|
    options[(key.to_sym rescue key) || key] = value
    options
  end
end