class Totoro::Utils
Public Instance Methods
underscore_hash_keys(value)
click to toggle source
# File lib/totoro/utils.rb, line 5 def underscore_hash_keys(value) case value when Array value.map { |v| underscore_hash_keys(v) } when Hash Hash[value.map { |k, v| [underscorize(k), underscore_hash_keys(v)] }] else value end end
Private Instance Methods
underscorize(hash_key)
click to toggle source
# File lib/totoro/utils.rb, line 18 def underscorize(hash_key) hash_key.to_s.underscore.to_sym end