Class: Hash
Instance Method Summary collapse
-
#to_proc ⇒ Proc
Convert Hash into a Proc that takes a key and returns the value of the Hash for that key.
Instance Method Details
#to_proc ⇒ Proc
Convert Hash into a Proc that takes a key and returns the value of the Hash for that key.
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 |