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:



501
502
503
# File 'lib/graph.rb', line 501

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.



516
517
518
519
520
521
# File 'lib/graph.rb', line 516

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.



508
509
510
# File 'lib/graph.rb', line 508

def push attrib
  attr.push attrib
end

#to_sObject

:nodoc:



523
524
525
# File 'lib/graph.rb', line 523

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