Module: Symbiont
- Defined in:
- lib/symbiont.rb,
lib/symbiont/context.rb,
lib/symbiont/version.rb,
lib/symbiont/executor.rb,
lib/symbiont/isolator.rb,
lib/symbiont/public_trigger.rb,
lib/symbiont/private_trigger.rb
Overview
Main Symbiont namespace.
Defined Under Namespace
Modules: Executor Classes: Isolator, PrivateTrigger, PublicTrigger, Trigger
Constant Summary collapse
- IOK =
Method delegation order alias (inner_contexts => outer_context => kernel_context).
Trigger::IOK
- OIK =
Method delegation order alias (outer_context => inner_contexts => kernel_context).
Trigger::OIK
- OKI =
Method delegation order alias (outer_context => kernel_context => inner_contexts).
Trigger::OKI
- IKO =
Method delegation order alias (inner_contexts => kernel_context => outer_context).
Trigger::IKO
- KOI =
Method delegation order alias (kernel_context => outer_context => inner_contexts).
Trigger::KOI
- KIO =
Method delegation order alias (kernel_context => inner_contexts => outer_context).
Trigger::KIO
- Context =
Default Context mixin that provides an ability to invoke procs and lambdas in many contexts to any object. Mixes up special methods that delegate execution logic to to a special mediator object (
Symbiont::Executor
). Uses Symbiont::Trigger::IOK delegation order. Context(Trigger::IOK)
- VERSION =
Symbiont Version :)
'0.6.0'
Class Method Summary collapse
-
.Context(default_context_direction = Trigger::IOK) ⇒ Module
Factory method for a mixin module that provides an ability to invoke procs and lambdas in many contexts to any object.
Class Method Details
.Context(default_context_direction = Trigger::IOK) ⇒ Module
Factory method for a mixin module that provides an ability to invoke procs and lambdas
in many contexts to any object. Mixes up special methods that delegate execution logic to
to a special mediator object (Symbiont::Executor
).
rubocop:disable Naming/MethodName
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/symbiont/context.rb', line 22 def Context(default_context_direction = Trigger::IOK) Module.new do define_method :evaluate do |context_direction = default_context_direction, &closure| Executor.evaluate(self, context_direction: context_direction, &closure) end define_method :evaluate_private do |context_direction = default_context_direction, &closure| Executor.evaluate_private(self, context_direction: context_direction, &closure) end define_method :public_method do |method_name, context_direction = default_context_direction, &closure| Executor.public_method(self, method_name, context_direction: context_direction, &closure) end define_method :private_method do |method_name, context_direction = default_context_direction, &closure| Executor.private_method(self, method_name, context_direction: context_direction, &closure) end end end |