Class: Symbiont::PrivateTrigger Private

Inherits:
Trigger
  • Object
show all
Defined in:
lib/symbiont/private_trigger.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A trigger that considers both public and private methods of executable contexts during method dispatching.

See Also:

Since:

  • 0.1.0

Constant Summary

Constants inherited from Trigger

Trigger::ContextNoMethodError, Trigger::IKO, Trigger::IOK, Trigger::IncompatibleContextDirectionError, Trigger::KIO, Trigger::KOI, Trigger::OIK, Trigger::OKI, Trigger::UnprovidedClosureAttributeError

Instance Attribute Summary

Attributes inherited from Trigger

#__closure__, #__context_direction__, #__inner_contexts__, #__kernel_context__, #__outer_context__

Instance Method Summary collapse

Methods inherited from Trigger

#__directed_contexts__, #__evaluate__, #initialize, #method, #method_missing, #respond_to_missing?

Constructor Details

This class inherits a constructor from Symbiont::Trigger

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Symbiont::Trigger

Instance Method Details

#__actual_context__(method_name) ⇒ Objcet

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the first context that is able to respond to the required method. The context is chosen in the context direction order (see #context_direction). Raises NoMethodError excepition when no one of the contexts are able to respond to the required method. Basicaly (in #super), abstract implementation raises NoMethodError.

Parameters:

  • method_name (String, Symbol)

    Method that a context should respond to.

Returns:

  • (Objcet)

Raises:

  • NoMethodError Is raised when no one of the contexts are able to respond to the required method.

See Also:

Since:

  • 0.1.0


27
28
29
30
31
# File 'lib/symbiont/private_trigger.rb', line 27

def __actual_context__(method_name)
  __directed_contexts__.find do |context|
    context.respond_to?(method_name, true)
  end || super
end