Module: Callable

Defined in:
lib/callable.rb,
lib/callable/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#Callable(callable_or_not) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/callable.rb', line 4

def Callable( callable_or_not )
  if callable_or_not.respond_to?(:call)
    callable_or_not
  else
    proc { |*args| callable_or_not }
  end
end

#callableObject



12
13
14
# File 'lib/callable.rb', line 12

def callable
  Callable(self)
end

#callable?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/callable.rb', line 16

def callable?
  self.respond_to?(:call)
end