Sha256: f5d87b0155ece2069b2b1a3930d5ce83f1da81e00a88c6c1aac902cb74f0578f

Contents?: true

Size: 256 Bytes

Versions: 1

Compression:

Stored size: 256 Bytes

Contents

# Nabbed, http://www.ruby-forum.com/topic/149449
class Hash

  # Returns a new hash with only the given keys.
  def slice(keys = [])
    h = {}
    keys.each do |key|
      raise IndexError if self[key].nil?
      h[key] = self[key]
    end
    h
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-smoke-1.0.0 lib/core_ext/hash.rb