class Ravanello::Resolver::NodeResolver

Resolves endpoint by node

Attributes

node[R]
path[R]

Public Class Methods

new(node, *path) click to toggle source
# File lib/ravanello/resolver.rb, line 26
def initialize(node, *path)
  @node = node
  @path = path
end

Public Instance Methods

call() click to toggle source
# File lib/ravanello/resolver.rb, line 31
def call
  if node.routable?(path)
    new_path = node.route(path)
    return node if new_path.empty?

    node.children.each do |child|
      resolved = NodeResolver.new(child, *new_path).call
      return resolved unless resolved.nil?
    end
  end

  nil
end