module Symbiont

Main Symbiont namespace.

@api public @since 0.1.0

Constants

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 Symbiont.Context

@api public @since 0.1.0

IKO

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

@see Symbiont::Trigger::IKO

@api public @since 0.1.0

IOK

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

@see Symbiont::Trigger::IOK

@api public @since 0.1.0

KIO

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

@see Symbiont::Trigger::KIO

@api public @since 0.1.0

KOI

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

@see Symbiont::Trigger::IOK

@api public @since 0.1.0

OIK

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

@see Symbiont::Trigger::OIK

@api public @since 0.1.0

OKI

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

@see Symbiont::Trigger::OKI

@api public @since 0.1.0

VERSION

Symbiont Version :)

@api public @since 0.1.0

Public Class Methods

Context(default_context_direction = Trigger::IOK) click to toggle source

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`).

@param default_context_direction [Array<Symbol>]

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

@return [Module]

@see Symbiont::Executor @see Symbiont::Trigger @see Symbiont::PublicTrigger @see Symbiont::PrivateTrigger

@api public @since 0.1.0

rubocop:disable Naming/MethodName

# 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