Module: Hashie::HashExtensions

### Home Classes Methods

### In Files

- lib/hashie/hash_extensions.rb

### Methods

- ::included
- #hashie_stringify_keys
- #hashie_stringify_keys!
- #to_mash

### Class/Module Index

Quicksearch

- Hashie
- Hashie::Clash
- Hashie::Clash::ChainError
- Hashie::Dash
- Hashie::Extensions
- Hashie::Extensions::Coercion
- Hashie::Extensions::Coercion::ClassMethods
- Hashie::Extensions::Coercion::InstanceMethods
- Hashie::Extensions::DeepFetch
- Hashie::Extensions::DeepFetch::UndefinedPathError
- Hashie::Extensions::DeepMerge
- Hashie::Extensions::IgnoreUndeclared
- Hashie::Extensions::IndifferentAccess
- Hashie::Extensions::KeyConversion
- Hashie::Extensions::MergeInitializer
- Hashie::Extensions::MethodAccess
- Hashie::Extensions::MethodQuery
- Hashie::Extensions::MethodReader
- Hashie::Extensions::MethodWriter
- Hashie::Extensions::StringifyKeys
- Hashie::Extensions::SymbolizeKeys
- Hashie::Hash
- Hashie::HashExtensions
- Hashie::Mash
- Hashie::PrettyInspect
- Hashie::Rash
- Hashie::Trash

No matching classes.

# Hashie::HashExtensions

### Public Class Methods

included(base) click to toggle source

    # File lib/hashie/hash_extensions.rb, line 3
    def self.included(base)
      # Don't tread on existing extensions of Hash by
      # adding methods that are likely to exist.
      %(stringify_keys stringify_keys!).each do |hashie_method|
        base.send :alias_method, hashie_method, "hashie_#{hashie_method}" unless base.instance_methods.include?(hashie_method)
      end
    end

### Public Instance Methods

hashie_stringify_keys() click to toggle source

Convert all of the keys of a Hash to their string representations.

    # File lib/hashie/hash_extensions.rb, line 22
    def hashie_stringify_keys
      dup.stringify_keys!
    end

hashie_stringify_keys!() click to toggle source

Destructively convert all of the keys of a Hash to their string representations.

    # File lib/hashie/hash_extensions.rb, line 13
    def hashie_stringify_keys!
      keys.each do |k|
        self[k.to_s] = delete(k) unless String === k
      end
      self
    end

to_mash() click to toggle source

Convert this hash into a Mash

    # File lib/hashie/hash_extensions.rb, line 27
    def to_mash
      ::Hashie::Mash.new(self)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.