Class: Object

Inherits:
BasicObject
Defined in:
lib/data/functions/object.rb

Instance Method Summary collapse

Instance Method Details

#to_procProc

If object responds to ‘call` convert into a Proc that takes a key and returns the value of the Hash for that key.

Returns:

  • (Proc)


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