class Terraspace::Dependency::Node

Attributes

children[RW]
filtered[RW]
name[R]
parents[RW]

Public Class Methods

find_by(name:) click to toggle source
# File lib/terraspace/dependency/node.rb, line 33
def find_by(name:)
  @@nodes.find { |n| n.name == name }
end
find_or_create_by(name:) click to toggle source
# File lib/terraspace/dependency/node.rb, line 25
def find_or_create_by(name:)
  node = find_by(name: name)
  return node if node
  node = Node.new(name)
  @@nodes << node
  node
end
new(name) click to toggle source
# File lib/terraspace/dependency/node.rb, line 5
def initialize(name)
  @name = name
  @children, @parents = Set.new, Set.new
end

Public Instance Methods

highlighted?() click to toggle source
# File lib/terraspace/dependency/node.rb, line 10
def highlighted?
  @filtered
end
inspect() click to toggle source
# File lib/terraspace/dependency/node.rb, line 14
def inspect
  @name
end
parent!(parent) click to toggle source
# File lib/terraspace/dependency/node.rb, line 18
def parent!(parent)
  @parents << parent
  parent.children << self
end