Sha256: 5b937befa4128f50544d99096878a97e7bc5fc06866a35cafbde60fbaeb5440d

Contents?: true

Size: 324 Bytes

Versions: 2

Compression:

Stored size: 324 Bytes

Contents

module HashSlice
  # From ActiveSupport
  def slice(*keys)
    keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
    hash = self.class.new
    keys.each { |k| hash[k] = self[k] if has_key?(k) }
    hash
  end
end

Hash.instance_eval { include HashSlice } unless Hash.instance_methods.include?(:slice)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-boxen-0.0.4 lib/vagrant-boxen/hash_slice.rb
vagrant-boxen-0.0.3 lib/vagrant-boxen/hash_slice.rb