Class: Hash

Inherits:
Object show all
Defined in:
lib/sbn/helpers.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#symbolize_keys_and_valuesObject



87
88
89
90
91
92
93
94
# File 'lib/sbn/helpers.rb', line 87

def symbolize_keys_and_values
  inject({}) do |options, (key, value)|
    key = key.to_underscore_sym
    value = value.to_underscore_sym
    options[key] = value
    options
  end
end

#symbolize_keys_and_values!Object



96
97
98
99
100
101
102
103
# File 'lib/sbn/helpers.rb', line 96

def symbolize_keys_and_values!
  keys.each do |key|
    newkey = key.to_underscore_sym
    self[newkey] = self[key].to_underscore_sym
    delete(key) unless key == newkey
  end
  self
end