module Hashie
Hash-like objects and extensions for structured data.
@example Access nested data using a Mash
Hashie::Mash.new(author: { name: 'Ada' }).author.name # => 'Ada'
Copyright © Chad Fowler, Rich Kilmer, Jim Weirich and others. Portions copyright © Engine Yard and Andre Arko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Constants
- VERSION
Public Class Methods
The logger that Hashie uses for reporting errors.
@return [Logger]
@example Obtain the logger used for warnings
Hashie.logger.respond_to?(:warn) # => true
# File lib/hashie/logger.rb, line 12 def self.logger @logger ||= Logger.new($stdout) end
Sets the logger that Hashie uses for reporting errors.
@param logger [Logger] The logger to set as Hashie's logger. @return [void]
@example Temporarily capture warnings
require 'stringio' original = Hashie.logger begin output = StringIO.new Hashie.logger = Logger.new(output) Hashie.logger.warn('example warning') output.string.include?('example warning') # => true ensure Hashie.logger = original end
# File lib/hashie/logger.rb, line 32 def self.logger=(logger) @logger = logger end