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.
439 440 441 |
# File 'lib/graph.rb', line 439 def initialize graph super graph, [] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
438 439 440 |
# File 'lib/graph.rb', line 438 def attributes @attributes end |
#graph ⇒ Object
Returns the value of attribute graph
438 439 440 |
# File 'lib/graph.rb', line 438 def graph @graph end |
Instance Method Details
#attributes? ⇒ Boolean
Does this thing have attributes?
460 461 462 |
# File 'lib/graph.rb', line 460 def attributes? not self.attributes.empty? end |
#initialize_copy(other) ⇒ Object
:nodoc:
443 444 445 446 |
# File 'lib/graph.rb', line 443 def initialize_copy other # :nodoc: super self.attributes = other.attributes.dup end |
#label(name) ⇒ Object
Shortcut method to set the label attribute.
451 452 453 454 455 |
# File 'lib/graph.rb', line 451 def label name attributes.reject! { |s| s =~ /^label =/ } attributes << "label = \"#{name.gsub(/\n/, '\n')}\"" self end |