Hashie::HashExtensions

Public Class Methods

included(base) click to toggle source
   # File lib/hashie/hash_extensions.rb, line 3
3:     def self.included(base)
4:       # Don't tread on existing extensions of Hash by
5:       # adding methods that are likely to exist.
6:       %(stringify_keys stringify_keys!).each do |hashie_method|
7:         base.send :alias_method, hashie_method, "hashie_#{hashie_method}" unless base.instance_methods.include?(hashie_method)
8:       end
9:     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 24
24:     def hashie_stringify_keys
25:       self.dup.stringify_keys!
26:     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
13:     def hashie_stringify_keys!
14:       self.keys.each do |k|
15:         unless String === k
16:           self[k.to_s] = self.delete(k)
17:         end
18:       end
19:       self
20:     end
to_mash() click to toggle source

Convert this hash into a Mash

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.