Module: Callable
- Defined in:
- lib/callable.rb,
lib/callable/version.rb
Defined Under Namespace
Classes: Undefined
Constant Summary collapse
- VERSION =
"0.0.5"
Instance Method Summary collapse
Instance Method Details
#Callable(callable_or_not, default: Undefined) ⇒ Object
4 5 6 7 8 9 10 11 |
# 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 ⇒ Object
13 14 15 |
# File 'lib/callable.rb', line 13 def callable Callable(self) end |
#callable? ⇒ Boolean
17 18 19 |
# File 'lib/callable.rb', line 17 def callable? self.respond_to?(:call) end |