Class: Graph::CompoundAttribute

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

Overview

An attribute… that’s compound. So much for self-documenting code. :(

Instance Attribute Summary

Attributes inherited from Attribute

#attr

Instance Method Summary collapse

Methods inherited from Attribute

#+

Constructor Details

#initialize(attr = []) ⇒ CompoundAttribute

:nodoc:



467
468
469
# File 'lib/graph.rb', line 467

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.



482
483
484
485
486
487
# File 'lib/graph.rb', line 482

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.



474
475
476
# File 'lib/graph.rb', line 474

def push attrib
  attr.push attrib
end

#to_sObject

:nodoc:



489
490
491
# File 'lib/graph.rb', line 489

def to_s # :nodoc:
  attr.join ", "
end