Module: Easyop::Operation::ClassMethods
- Defined in:
- lib/easyop/operation.rb
Overview
── Class-level API ───────────────────────────────────────────────────────
Instance Method Summary collapse
- #_registered_plugins ⇒ Object
-
#call(attrs = {}) ⇒ Object
Call the operation.
-
#call!(attrs = {}) ⇒ Object
Call the operation.
-
#plugin(plugin_mod, **options) ⇒ Object
Install a plugin onto this operation class.
Instance Method Details
#_registered_plugins ⇒ Object
52 53 54 |
# File 'lib/easyop/operation.rb', line 52 def _registered_plugins @_registered_plugins ||= [] end |
#call(attrs = {}) ⇒ Object
Call the operation. Always returns ctx, never raises on ctx.fail!. Other (unhandled) exceptions propagate normally.
31 32 33 |
# File 'lib/easyop/operation.rb', line 31 def call(attrs = {}) new._easyop_run(Ctx.build(attrs), raise_on_failure: false) end |
#call!(attrs = {}) ⇒ Object
Call the operation. Returns ctx on success, raises Ctx::Failure on fail!.
36 37 38 |
# File 'lib/easyop/operation.rb', line 36 def call!(attrs = {}) new._easyop_run(Ctx.build(attrs), raise_on_failure: true) end |
#plugin(plugin_mod, **options) ⇒ Object
47 48 49 50 |
# File 'lib/easyop/operation.rb', line 47 def plugin(plugin_mod, **) plugin_mod.install(self, **) _registered_plugins << { plugin: plugin_mod, options: } end |