Class: Yaso::Invocable
- Inherits:
-
Object
- Object
- Yaso::Invocable
- Defined in:
- lib/yaso/invocable.rb
Constant Summary collapse
- METHOD =
:method
- CALLABLE =
:callable
- YASO =
:yaso
Class Method Summary collapse
Class Method Details
.call(object, options: {}, with_block: false) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/yaso/invocable.rb', line 10 def call(object, options: {}, with_block: false, **) type = object_type(object) invocable = case type when YASO then proc { |context| object.call(context).success? } when CALLABLE then callable_invocable(object, , with_block: with_block) else method_invocable(object, with_block: with_block) end [type, invocable] end |