Class: Gviz::Node

Inherits:
Struct show all
Defined in:
lib/gviz/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, attrs = {}) ⇒ Node

Returns a new instance of Node.

Raises:

  • (ArgumentError)


2
3
4
5
6
# File 'lib/gviz/node.rb', line 2

def initialize(id, attrs={})
  raise ArgumentError, 'node `id` must a symbol' unless id.is_a?(Symbol)
  raise ArgumentError, "node `id` must not include underscores" if id.match(/_/)
  super
end

Instance Attribute Details

#attrsObject

Returns the value of attribute attrs

Returns:

  • (Object)

    the current value of attrs



1
2
3
# File 'lib/gviz/node.rb', line 1

def attrs
  @attrs
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



1
2
3
# File 'lib/gviz/node.rb', line 1

def id
  @id
end

Instance Method Details

#to_sObject



8
9
10
# File 'lib/gviz/node.rb', line 8

def to_s
  "#{id}"
end