Class: Tengine::Job::Runtime::Vertex
- Inherits:
-
Object
- Object
- Tengine::Job::Runtime::Vertex
show all
- Includes:
- Mongoid::Document, Mongoid::Timestamps, Signal::Transmittable, Structure::NamePath, Structure::Tree, Structure::Visitor::Accepter
- Defined in:
- lib/tengine/job/runtime/vertex.rb
Overview
Edgeとともにジョブネットを構成するグラフの「頂点」を表すモデルです。
このクラスだけでツリー構造を作ることができますが、ほぼ抽象クラスであり実際には
派生クラスのオブジェクトによってツリー構造が作られます。
Instance Method Summary
collapse
Instance Method Details
#ancestors_until_expansion ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/tengine/job/runtime/vertex.rb', line 37
def ancestors_until_expansion
if parent = self.parent
parent.ancestors_until_expansion + [parent]
else
[]
end
end
|
#next_edges ⇒ Object
32
33
34
35
|
# File 'lib/tengine/job/runtime/vertex.rb', line 32
def next_edges
return nil unless parent
parent.edges.select{|edge| edge.origin_id == self.id}
end
|
#previous_edges ⇒ Object
Also known as:
prev_edges
26
27
28
29
|
# File 'lib/tengine/job/runtime/vertex.rb', line 26
def previous_edges
return nil unless parent
parent.edges.select{|edge| edge.destination_id == self.id}
end
|
#runtime? ⇒ Boolean
24
|
# File 'lib/tengine/job/runtime/vertex.rb', line 24
def runtime?; !template?; end
|
#save_descendants! ⇒ Object
Tengine::Job::Runtime::Vertexは構成されるツリーのルートを保存しても、embedでないので
各vertexをsaveしないと保存されないため、明示的に保存しています。
47
48
49
|
# File 'lib/tengine/job/runtime/vertex.rb', line 47
def save_descendants!
accept_visitor(Tengine::Job::Structure::Visitor::All.new{|v| v.save! })
end
|
#template? ⇒ Boolean
23
|
# File 'lib/tengine/job/runtime/vertex.rb', line 23
def template?; false; end
|