Method: Hash#to_proc
- Defined in:
- lib/invokable/hash.rb
#to_proc ⇒ Proc
Return a proc that takes a key and returns the value associated with it or nil if the key is not present in the hash.
10 11 12 13 14 |
# File 'lib/invokable/hash.rb', line 10 def to_proc lambda do |key| fetch(key) { nil } end end |