module CallableTree::Node

Attributes

parent[RW]

Public Instance Methods

ancestors() click to toggle source
# File lib/callable_tree/node.rb, line 11
def ancestors
  ::Enumerator.new do |y|
    node = self
    loop do
      y << node
      break unless node = node.parent
    end
  end
end
call(_input = nil, **_options) click to toggle source
# File lib/callable_tree/node.rb, line 37
def call(_input = nil, **_options)
  raise ::CallableTree::Error, 'Not implemented'
end
depth() click to toggle source
# File lib/callable_tree/node.rb, line 29
def depth
  root? ? 0 : parent.depth + 1
end
identity() click to toggle source
# File lib/callable_tree/node.rb, line 25
def identity
  self.class
end
match?(_input = nil, **_options) click to toggle source
# File lib/callable_tree/node.rb, line 33
def match?(_input = nil, **_options)
  true
end
root?() click to toggle source
# File lib/callable_tree/node.rb, line 7
def root?
  parent.nil?
end
routes() click to toggle source
# File lib/callable_tree/node.rb, line 21
def routes
  ancestors.map(&:identity)
end
terminate?(output = nil, **_options) click to toggle source
# File lib/callable_tree/node.rb, line 41
def terminate?(output = nil, **_options)
  !output.nil?
end