class Tengine::Job::Structure::ElementSelectorNotation::PathFinder
Public Class Methods
new(client, origin, dest)
click to toggle source
# File lib/tengine/job/structure/element_selector_notation.rb, line 141 def initialize(client, origin, dest) @client = client @origin, @dest = origin, dest end
Public Instance Methods
process()
click to toggle source
# File lib/tengine/job/structure/element_selector_notation.rb, line 146 def process @routes = [] @current_route = [] @origin.accept_visitor(self) @routes.select{|route| route.last == @dest} end
visit(element)
click to toggle source
# File lib/tengine/job/structure/element_selector_notation.rb, line 153 def visit(element) @current_route << element if element.is_a?(@client.base_module.const_get(:Edge)) element.destination.accept_visitor(self) else @routes << @current_route.dup return if element == @dest element.next_edges.each do |edge| bak = @current_route.dup begin edge.accept_visitor(self) ensure @current_route = bak end end end end