class CircularDependencyError

循环依赖检测时用到的一个异常类型,便于抛异常时传递参数

Attributes

from[RW]
message[RW]
path[RW]
to[RW]

Public Class Methods

new(from, to , path , message = 'Circular dependency detected!') click to toggle source

@param [String] from 循环依赖上端点 @param [String] to 循环依赖下端点 @param [Array<String>] path 循环依赖路径上的节点名 @param [String] message 附加消息

# File lib/dep_check/CircularDependencyError.rb, line 12
def initialize(from, to , path , message = 'Circular dependency detected!')
  @from = from
  @to = to
  @path = path
  @message = message
end

Public Instance Methods

to_s() click to toggle source
# File lib/dep_check/CircularDependencyError.rb, line 19
def to_s
  path_message = String.new
  @path.each { |name|
    path_message << name + '--->'
  }
  path_message << @to

  "#{super} \n #{@message} \n #{@from} <---> #{@to} . \n Full Path: #{path_message} "
end