Sha256: 2575c5e665cbd5aaa021c30c6d07d81d7a4c87545d8d67fe7b3f358dbe818f21
Contents?: true
Size: 1023 Bytes
Versions: 8
Compression:
Stored size: 1023 Bytes
Contents
module Hashie module Extensions module Mash # 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 module SymbolizeKeys # Hook for being included in a class # # @api private # @return [void] # @raise [ArgumentError] when the base class isn't a Mash def self.included(base) fail ArgumentError, "#{base} must descent from Hashie::Mash" unless base <= Hashie::Mash end private # Converts a key to a symbol # # @api private # @param [String, Symbol] key the key to convert to a symbol # @return [void] def convert_key(key) key.to_sym end end end end end
Version data entries
8 entries across 7 versions & 2 rubygems