module Morfo::Tools::ExtendedHash

Public Instance Methods

symbolize_keys(hash) click to toggle source
# File lib/morfo/tools.rb, line 6
def symbolize_keys(hash)
  transform_keys(hash) { |key| key.to_sym rescue key }
end
transform_keys(hash) { |key| ... } click to toggle source
# File lib/morfo/tools.rb, line 10
def transform_keys(hash)
  return hash.enum_for(:transform_keys) { size } unless block_given?
  result = {}
  hash.each_key do |key|
    result[yield(key)] = hash[key]
  end
  result
end