# 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
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
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
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.
Generated with the Darkfish Rdoc Generator 1.1.6.