Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/data/functions/object.rb
Instance Method Summary collapse
-
#to_proc ⇒ Proc
If object responds to ‘call` convert into a Proc that takes a key and returns the value of the Hash for that key.
Instance Method Details
#to_proc ⇒ Proc
If object responds to ‘call` convert into a Proc that takes a key and returns the value of the Hash for that key.
5 6 7 8 9 10 11 12 13 |
# File 'lib/data/functions/object.rb', line 5 def to_proc if respond_to?(:call) Proc.new do |*args| call(*args) end else raise "Don't know how to convert #{self.inspect} into a Proc" end end |