nested_under_indifferent_access

nested_under_indifferent_access() Instance Public methods Called when object is nested under an object that receives with_indifferent_access. This method will be called on the current object by the enclosing object and is aliased to with_indifferent_access by default. Subclasses of Hash may overwrite this method to return self if converting to an ActiveSupport::HashWithIndifferentAccess would not be desirable. b = { b: 1 } { a: b }.with_indifferent_access['a'] # calls b.nested_unde

extractable_options?

extractable_options?() Instance Public methods By default, only instances of Hash itself are extractable. Subclasses of Hash may implement this method and return true to declare themselves as extractable. If a Hash is extractable, Array#extract_options! pops it from the Array when it is the last element of the Array.

extract!

extract!(*keys) Instance Public methods Removes and returns the key/value pairs matching the given keys. { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2} { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1}

except!

except!(*keys) Instance Public methods Replaces the hash without the given keys.

except

except(*keys) Instance Public methods Returns a hash that includes everything but the given keys. This is useful for limiting a set of parameters to everything but a few known toggles: @person.update(params[:person].except(:admin))

deep_transform_keys!

deep_transform_keys!(&block) Instance Public methods Destructively convert all keys by using the block operation. This includes the keys from the root hash and from all nested hashes and arrays.

deep_transform_keys

deep_transform_keys(&block) Instance Public methods Returns a new hash with all keys converted by the block operation. This includes the keys from the root hash and from all nested hashes and arrays. hash = { person: { name: 'Rob', age: '28' } } hash.deep_transform_keys{ |key| key.to_s.upcase } # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}

deep_symbolize_keys!

deep_symbolize_keys!() Instance Public methods Destructively convert all keys to symbols, as long as they respond to to_sym. This includes the keys from the root hash and from all nested hashes and arrays.

deep_symbolize_keys

deep_symbolize_keys() Instance Public methods Returns a new hash with all keys converted to symbols, as long as they respond to to_sym. This includes the keys from the root hash and from all nested hashes and arrays. hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } } hash.deep_symbolize_keys # => {:person=>{:name=>"Rob", :age=>"28"}}

deep_stringify_keys!

deep_stringify_keys!() Instance Public methods Destructively convert all keys to strings. This includes the keys from the root hash and from all nested hashes and arrays.