module Muwu::Helper::HashHelper

Public Instance Methods

human_readable_hash(incoming_hash) click to toggle source
# File lib/muwu/helper/hash_helper.rb, line 9
def human_readable_hash(incoming_hash)
  result_hash = {}
  incoming_hash.each_pair do |k, v|
    key = human_readable_key(k)
    value = human_readable_value(v)
    result_hash[key] = value
  end
  result_hash
end
human_readable_key(k) click to toggle source
# File lib/muwu/helper/hash_helper.rb, line 20
def human_readable_key(k)
  k.to_s.gsub(/\A:/,'')
end
human_readable_value(v) click to toggle source
# File lib/muwu/helper/hash_helper.rb, line 25
def human_readable_value(v)
  case v
  when Array
    return v.join(', ')
  else
    return v
  end
end