Class: Hash

Inherits:
Object show all
Defined in:
lib/lab42/core/hash.rb

Instance Method Summary collapse

Instance Method Details

#only(*args) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/lab42/core/hash.rb', line 2

def only *args
  args.inject Hash.new do | r, k |
    if has_key? k
      r.merge k => self[k]
    else
      r
    end
  end
end