Module: Hashie::Extensions::Mash::SymbolizeKeys

Defined in:
lib/hashie/extensions/mash/symbolize_keys.rb

Overview

Overrides Mash's default behavior of converting keys to strings

Examples:

class LazyResponse < Hashie::Mash
  include Hashie::Extensions::Mash::SymbolizeKeys
end

response = LazyResponse.new("id" => 123, "name" => "Rey").to_h
#=> {id: 123, name: "Rey"}

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Hook for being included in a class

Raises:

  • (ArgumentError)

    when the base class isn't a Mash



21
22
23
# File 'lib/hashie/extensions/mash/symbolize_keys.rb', line 21

def self.included(base)
  raise ArgumentError, "#{base} must descent from Hashie::Mash" unless base <= Hashie::Mash
end