module Hashie::Extensions::Mash::SymbolizeKeys
Overrides Mash's default behavior of converting keys to strings
@example
class LazyResponse < Hashie::Mash include Hashie::Extensions::Mash::SymbolizedKeys end response = LazyResponse.new("id" => 123, "name" => "Rey").to_h #=> {id: 123, name: "Rey"}
@api public
Public Class Methods
included(base)
click to toggle source
Hook for being included in a class
@api private @return [void] @raise [ArgumentError] when the base class isn't a Mash
# File lib/hashie/extensions/mash/symbolize_keys.rb, line 21 def self.included(base) fail ArgumentError, "#{base} must descent from Hashie::Mash" unless base <= Hashie::Mash end
Private Instance Methods
convert_key(key)
click to toggle source
Converts a key to a symbol
@api private @param [String, Symbol] key the key to convert to a symbol @return [void]
# File lib/hashie/extensions/mash/symbolize_keys.rb, line 32 def convert_key(key) key.to_sym end