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.



412
413
414
# File 'lib/graph.rb', line 412

def initialize attr = []
  super
end

Instance Method Details

#<<(thing) ⇒ Object



420
421
422
423
424
425
# File 'lib/graph.rb', line 420

def << thing
  attr.each do |subattr|
    subattr << thing # allows for recursive compound attributes
  end
  self
end

#push(attrib) ⇒ Object



416
417
418
# File 'lib/graph.rb', line 416

def push attrib
  attr.push attrib
end

#to_sObject



427
428
429
# File 'lib/graph.rb', line 427

def to_s
  attr.join ", "
end