Class: Graph::CompoundAttribute
- Defined in:
- lib/graph.rb
Instance Attribute Summary
Attributes inherited from Attribute
Instance Method Summary collapse
- #<<(thing) ⇒ Object
-
#initialize(attr = []) ⇒ CompoundAttribute
constructor
A new instance of CompoundAttribute.
- #push(attrib) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Attribute
Constructor Details
#initialize(attr = []) ⇒ CompoundAttribute
Returns a new instance of CompoundAttribute.
418 419 420 |
# File 'lib/graph.rb', line 418 def initialize attr = [] super end |
Instance Method Details
#<<(thing) ⇒ Object
426 427 428 429 430 431 |
# File 'lib/graph.rb', line 426 def << thing attr.each do |subattr| subattr << thing # allows for recursive compound attributes end self end |
#push(attrib) ⇒ Object
422 423 424 |
# File 'lib/graph.rb', line 422 def push attrib attr.push attrib end |
#to_s ⇒ Object
433 434 435 |
# File 'lib/graph.rb', line 433 def to_s attr.join ", " end |