module Callable

Constants

VERSION

Public Instance Methods

Callable( callable_or_not, default: Undefined ) click to toggle source
# File lib/callable.rb, line 4
def Callable( callable_or_not, default: Undefined )
  return Callable(default) if callable_or_not.nil? && default != Undefined
  if callable_or_not.respond_to?(:call)
    callable_or_not
  else
    proc { |*args| callable_or_not }
  end
end
callable() click to toggle source
# File lib/callable.rb, line 13
def callable
  Callable(self)
end
callable?() click to toggle source
# File lib/callable.rb, line 17
def callable?
  self.respond_to?(:call)
end