Class: Graph::CompoundAttribute

Inherits:
Attribute
  • Object
show all
Defined in:
lib/graph.rb

Instance Attribute Summary

Attributes inherited from Attribute

#attr

Instance Method Summary collapse

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_sObject



433
434
435
# File 'lib/graph.rb', line 433

def to_s
  attr.join ", "
end