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.

Since:

  • 0.1.0

Defined Under Namespace

Modules: Executor Classes: Isolator, PrivateTrigger, PublicTrigger, Trigger

Constant Summary collapse

IOK =

Method delegation order alias (inner_contexts => outer_context => kernel_context).

See Also:

Since:

  • 0.1.0

Trigger::IOK
OIK =

Method delegation order alias (outer_context => inner_contexts => kernel_context).

See Also:

Since:

  • 0.1.0

Trigger::OIK
OKI =

Method delegation order alias (outer_context => kernel_context => inner_contexts).

See Also:

Since:

  • 0.1.0

Trigger::OKI
IKO =

Method delegation order alias (inner_contexts => kernel_context => outer_context).

See Also:

Since:

  • 0.1.0

Trigger::IKO
KOI =

Method delegation order alias (kernel_context => outer_context => inner_contexts).

See Also:

Since:

  • 0.1.0

Trigger::KOI
KIO =

Method delegation order alias (kernel_context => inner_contexts => outer_context).

See Also:

Since:

  • 0.1.0

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.

See Also:

Since:

  • 0.1.0

Context(Trigger::IOK)
VERSION =

Symbiont Version :)

Since:

  • 0.1.0

'0.4.0'

Class Method Summary collapse

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

Parameters:

  • default_context_direction (Array<Symbol>) (defaults to: Trigger::IOK)

    Delegation order for Symbiont::Executor. Trigger::IOK is used by default.

Returns:

  • (Module)

See Also:

Since:

  • 0.1.0



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