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:



465
466
467
# File 'lib/graph.rb', line 465

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.



480
481
482
483
484
485
# File 'lib/graph.rb', line 480

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.



472
473
474
# File 'lib/graph.rb', line 472

def push attrib
  attr.push attrib
end

#to_sObject

:nodoc:



487
488
489
# File 'lib/graph.rb', line 487

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