Class: Graph::CompoundAttribute
- Defined in:
- lib/graph.rb
Overview
An attribute… that’s compound. So much for self-documenting code. :(
Instance Attribute Summary
Attributes inherited from Attribute
Instance Method Summary collapse
-
#<<(thing) ⇒ Object
“Paint” a thingy with an attribute.
-
#initialize(attr = []) ⇒ CompoundAttribute
constructor
:nodoc:.
-
#push(attrib) ⇒ Object
Push an attribute into the list o’ attributes.
-
#to_s ⇒ Object
:nodoc:.
Methods inherited from Attribute
Constructor Details
#initialize(attr = []) ⇒ CompoundAttribute
:nodoc:
485 486 487 |
# File 'lib/graph.rb', line 485 def initialize attr = [] # :nodoc: super end |
Instance Method Details
#<<(thing) ⇒ Object
“Paint” a thingy with an attribute. Applies the attribute to the thingy. In this case, does it recursively.
500 501 502 503 504 505 |
# File 'lib/graph.rb', line 500 def << thing attr.each do |subattr| subattr << thing # allows for recursive compound attributes end self end |
#push(attrib) ⇒ Object
Push an attribute into the list o’ attributes.
492 493 494 |
# File 'lib/graph.rb', line 492 def push attrib attr.push attrib end |
#to_s ⇒ Object
:nodoc:
507 508 509 |
# File 'lib/graph.rb', line 507 def to_s # :nodoc: attr.join ", " end |