Class: Graph::Thingy
- Inherits:
-
Struct
- Object
- Struct
- Graph::Thingy
- Defined in:
- lib/graph.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#graph ⇒ Object
Returns the value of attribute graph.
Instance Method Summary collapse
-
#attributes? ⇒ Boolean
Does this thing have attributes?.
-
#initialize(graph) ⇒ Thingy
constructor
A new instance of Thingy.
-
#initialize_copy(other) ⇒ Object
:nodoc:.
-
#label(name) ⇒ Object
Shortcut method to set the label attribute.
Constructor Details
#initialize(graph) ⇒ Thingy
Returns a new instance of Thingy.
380 381 382 |
# File 'lib/graph.rb', line 380 def initialize graph super graph, [] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
379 380 381 |
# File 'lib/graph.rb', line 379 def attributes @attributes end |
#graph ⇒ Object
Returns the value of attribute graph
379 380 381 |
# File 'lib/graph.rb', line 379 def graph @graph end |
Instance Method Details
#attributes? ⇒ Boolean
Does this thing have attributes?
401 402 403 |
# File 'lib/graph.rb', line 401 def attributes? not self.attributes.empty? end |
#initialize_copy(other) ⇒ Object
:nodoc:
384 385 386 387 |
# File 'lib/graph.rb', line 384 def initialize_copy other # :nodoc: super self.attributes = other.attributes.dup end |
#label(name) ⇒ Object
Shortcut method to set the label attribute.
392 393 394 395 396 |
# File 'lib/graph.rb', line 392 def label name attributes.reject! { |s| s =~ /^label =/ } attributes << "label = \"#{name.gsub(/\n/, '\n')}\"" self end |