Class: Rukawa::Dag::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/rukawa/dag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, cluster = nil) ⇒ Edge

Returns a new instance of Edge.



108
109
110
# File 'lib/rukawa/dag.rb', line 108

def initialize(from, to, cluster = nil)
  @from, @to, @cluster = from, to, cluster
end

Instance Attribute Details

#clusterObject (readonly)

Returns the value of attribute cluster.



106
107
108
# File 'lib/rukawa/dag.rb', line 106

def cluster
  @cluster
end

#fromObject (readonly)

Returns the value of attribute from.



106
107
108
# File 'lib/rukawa/dag.rb', line 106

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



106
107
108
# File 'lib/rukawa/dag.rb', line 106

def to
  @to
end

Instance Method Details

#==(edge) ⇒ Object Also known as: eql?



116
117
118
119
# File 'lib/rukawa/dag.rb', line 116

def ==(edge)
  return false unless edge.is_a?(Edge)
  from == edge.from && to == edge.to
end

#hashObject



122
123
124
# File 'lib/rukawa/dag.rb', line 122

def hash
  [from, to].hash
end

#inspectObject



112
113
114
# File 'lib/rukawa/dag.rb', line 112

def inspect
  "#{@from.name} -> #{@to.name}"
end