Class: Mayu::Resources::DependencyGraph::Node

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mayu/resources/dependency_graph.rb

Constant Summary collapse

MarshalFormat =
T.type_alias { [Resource, T::Set[String], T::Set[String]] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Node

Returns a new instance of Node.



35
36
37
38
39
# File 'lib/mayu/resources/dependency_graph.rb', line 35

def initialize(resource)
  @resource = resource
  @incoming = T.let(Set.new, T::Set[String])
  @outgoing = T.let(Set.new, T::Set[String])
end

Instance Attribute Details

#incomingObject (readonly)

Returns the value of attribute incoming.



30
31
32
# File 'lib/mayu/resources/dependency_graph.rb', line 30

def incoming
  @incoming
end

#outgoingObject (readonly)

Returns the value of attribute outgoing.



32
33
34
# File 'lib/mayu/resources/dependency_graph.rb', line 32

def outgoing
  @outgoing
end

#resourceObject (readonly)

Returns the value of attribute resource.



28
29
30
# File 'lib/mayu/resources/dependency_graph.rb', line 28

def resource
  @resource
end

Instance Method Details

#delete(id) ⇒ Object



42
43
44
45
# File 'lib/mayu/resources/dependency_graph.rb', line 42

def delete(id)
  @incoming.delete(id)
  @outgoing.delete(id)
end

#marshal_dumpObject



51
52
53
# File 'lib/mayu/resources/dependency_graph.rb', line 51

def marshal_dump
  [@resource, @incoming, @outgoing]
end

#marshal_load(dumped) ⇒ Object



56
57
58
# File 'lib/mayu/resources/dependency_graph.rb', line 56

def marshal_load(dumped)
  @resource, @incoming, @outgoing = dumped
end