Class/Module Index [+]

Quicksearch

Nanoc3::HashExtensions

Public Instance Methods

stringify_keys() click to toggle source

Returns a new hash where all keys are recursively converted to strings by calling {Nanoc3::ArrayExtensions#stringify_keys} or {Nanoc3::HashExtensions#stringify_keys}.

@return [Hash] The converted hash

# File lib/nanoc3/base/core_ext/hash.rb, line 20
def stringify_keys
  inject({}) do |hash, (key, value)|
    hash.merge(key.to_s => value.respond_to?(:stringify_keys) ? value.stringify_keys : value)
  end
end
symbolize_keys() click to toggle source

Returns a new hash where all keys are recursively converted to symbols by calling {Nanoc3::ArrayExtensions#symbolize_keys} or {Nanoc3::HashExtensions#symbolize_keys}.

@return [Hash] The converted hash

# File lib/nanoc3/base/core_ext/hash.rb, line 9
def symbolize_keys
  inject({}) do |hash, (key, value)|
    hash.merge(key.to_sym => value.respond_to?(:symbolize_keys) ? value.symbolize_keys : value)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.