Module: Cape::CoreExt::Hash Private

Defined in:
lib/cape/core_ext/hash.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Adds methods missing from Ruby's Hash core class.

Instance Method Summary (collapse)

Instance Method Details

- (Hash) slice(*keys)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a copy of the Hash containing values only for the specified keys.



14
15
16
# File 'lib/cape/core_ext/hash.rb', line 14

def slice(*keys)
  ::Hash[select { |key, value| keys.include? key }]
end