Class: Tengine::Job::Template::Edge

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps, Core::SelectableAttr, Structure::Visitor::Accepter
Defined in:
lib/tengine/job/template/edge.rb

Overview

Vertexとともにジョブネットを構成するグラフの「辺」を表すモデル Tengine::Job::Template::Jobnetにembeddedされます。

Instance Method Summary collapse

Instance Method Details

#destinationObject



25
26
27
# File 'lib/tengine/job/template/edge.rb', line 25

def destination
  owner.children.detect{|c| c.id == destination_id}
end

#inspectObject



33
34
35
# File 'lib/tengine/job/template/edge.rb', line 33

def inspect
  "#<#{self.class.name} #{name_for_message}>"
end

#name_for_messageObject



29
30
31
# File 'lib/tengine/job/template/edge.rb', line 29

def name_for_message
  "edge(#{id.to_s}) from #{origin ? origin.name_path : 'no origin'} to #{destination ? destination.name_path : 'no destination'}"
end

#originObject



21
22
23
# File 'lib/tengine/job/template/edge.rb', line 21

def origin
  owner.children.detect{|c| c.id == origin_id}
end