Module: R10K::Action::Visitor Private

Includes:
Logging
Included in:
Deploy::Environment, Deploy::Module
Defined in:
lib/r10k/action/visitor.rb

Overview

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

Implement the Visitor pattern via pseudo double dispatch.

Visitor classes must implement #visit_type methods for each type that may be visited. If the visitor should descend into child objects the #visit_ method should yield to the passed block.

Visitor classes must implement #logger so that error messages can be logged.

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Method Summary collapse

Methods included from Logging

debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level

Instance Method Details

#visit(type, other, &block) ⇒ void

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.

This method returns an undefined value.

Dispatch to the type specific visitor method

Parameters:

  • type (Symbol)

    The object type to dispatch for

  • other (Object)

    The actual object to pass to the visitor method

  • block (Proc)

    The block that the called visitor method may yield to in case recursion is desired.



26
27
28
29
30
31
# File 'lib/r10k/action/visitor.rb', line 26

def visit(type, other, &block)
  send("visit_#{type}", other, &block)
rescue => e
  logger.error R10K::Errors::Formatting.format_exception(e, @trace)
  @visit_ok = false
end