Module | DataMapper::Ext::Hash |
In: |
lib/dm-core/support/ext/hash.rb
|
Returns a hash that includes everything but the given keys.
@param [Hash] hash The hash from which to pick the key/value pairs. @param [Array] *keys The hash keys to exclude.
@return [Hash] A new hash without the specified keys.
@example
hash = { :one => 1, :two => 2, :three => 3 } Ext::Hash.except(hash, :one, :two) # => { :three => 3 }
@api semipublic
Creates a hash with only the specified key/value pairs from hash.
@param [Hash] hash The hash from which to pick the key/value pairs. @param [Array] *keys The hash keys to include.
@return [Hash] A new hash with only the selected keys.
@example
hash = { :one => 1, :two => 2, :three => 3 } Ext::Hash.only(hash, :one, :two) # => { :one => 1, :two => 2 }
@api semipublic