Sha256: 35b494fad3864d787199852a73cc5f1b6ff2ffb0f722222e40168c18777b9091
Contents?: true
Size: 601 Bytes
Versions: 10
Compression:
Stored size: 601 Bytes
Contents
# encoding: utf-8 module Nanoc3::HashExtensions # Returns a new hash where all keys are recursively converted into symbols. def symbolize_keys inject({}) do |hash, (key, value)| hash.merge(key.to_sym => value.respond_to?(:symbolize_keys) ? value.symbolize_keys : value) end end # Returns a new hash where all keys are recursively converted to strings. def stringify_keys inject({}) do |hash, (key, value)| hash.merge(key.to_s => value.respond_to?(:stringify_keys) ? value.stringify_keys : value) end end end class Hash include Nanoc3::HashExtensions end
Version data entries
10 entries across 10 versions & 1 rubygems