Class: Tinydot::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Node

Returns a new instance of Node.



5
6
7
8
# File 'lib/tinydot/node.rb', line 5

def initialize(name)
  @name = name
  @edges = []
end

Instance Attribute Details

#edgesObject (readonly)

Returns the value of attribute edges.



3
4
5
# File 'lib/tinydot/node.rb', line 3

def edges
  @edges
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/tinydot/node.rb', line 3

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



15
16
17
18
# File 'lib/tinydot/node.rb', line 15

def <=>(other)
  @edges << Edge.new(self, other, dir: "both")
  other
end

#>>(other) ⇒ Object



10
11
12
13
# File 'lib/tinydot/node.rb', line 10

def >>(other)
  @edges << Edge.new(self, other)
  other
end