Class: Gviz::Node
Instance Attribute Summary collapse
-
#attrs ⇒ Object
Returns the value of attribute attrs.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id, attrs = {}) ⇒ Node
constructor
A new instance of Node.
- #to_s ⇒ Object
Constructor Details
#initialize(id, attrs = {}) ⇒ Node
Returns a new instance of Node.
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
#attrs ⇒ Object
Returns the value of attribute attrs
1 2 3 |
# File 'lib/gviz/node.rb', line 1 def attrs @attrs end |
#id ⇒ Object
Returns the value of attribute id
1 2 3 |
# File 'lib/gviz/node.rb', line 1 def id @id end |
Instance Method Details
#to_s ⇒ Object
8 9 10 |
# File 'lib/gviz/node.rb', line 8 def to_s "#{id}" end |