Class: RuTu::Edge

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

Instance Method Summary collapse

Constructor Details

#initialize(from, to, relation, options = {}) ⇒ Edge

Returns a new instance of Edge.



117
118
119
# File 'lib/RuTu.rb', line 117

def initialize(from, to, relation, options = {})
  @from, @to, @relation, @options = from, to, relation, options
end

Instance Method Details

#same?(from, to, relation) ⇒ Boolean

Returns:

  • (Boolean)


120
121
122
# File 'lib/RuTu.rb', line 120

def same?(from, to, relation)
  @from == from && @to == to && @relation == relation
end

#to_dot(to_set) ⇒ Object



123
124
125
126
# File 'lib/RuTu.rb', line 123

def to_dot(to_set)
  "#{@from.node_id}:#{@relation} -> #{@to.node_id}:header [ label = #{@relation} ]" + 
  ((@relation == "klass" && to_set.add?(@to)) ? "{ rank = same; #{@from.node_id}; #{@to.node_id}; }" : "")
end