Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/insensitive_hash.rb

Overview

:nodoc:

Direct Known Subclasses

InsensitiveHash

Instance Method Summary collapse

Instance Method Details

#insensitive(options = {}) ⇒ InsensitiveHash

Parameters:

  • options (Hash) (defaults to: {})

    Options

Options Hash (options):

  • :safe (Boolean)

    Whether to detect key clash on merge

Returns:



11
12
13
14
15
16
17
18
19
# File 'lib/insensitive_hash.rb', line 11

def insensitive options = {}
  InsensitiveHash.new.tap do |ih|
    ih.safe         = options[:safe] if options.key?(:safe)
    ih.default      = default
    ih.default_proc = default_proc if default_proc

    ih.merge_recursive!(self)
  end
end