Class: Hash

Inherits:
Object show all
Defined in:
lib/data/functions/hash.rb

Instance Method Summary collapse

Instance Method Details

#to_procProc

Convert Hash into a Proc that takes a key and returns the value of the Hash for that key.

Returns:

  • (Proc)


5
6
7
8
9
# File 'lib/data/functions/hash.rb', line 5

def to_proc
  lambda do |k, *_|
    self.fetch(k, nil)
  end
end