Class: Diaspora::Cluster::Creator::Template
- Inherits:
-
Object
- Object
- Diaspora::Cluster::Creator::Template
- Includes:
- Conversions
- Defined in:
- lib/diaspora-cluster-creator/template.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
Instance Method Summary collapse
-
#initialize(cluster) ⇒ Template
constructor
A new instance of Template.
- #to_dot(filename = 'cluster.dot') ⇒ Object
- #to_png(filename = 'cluster.png') ⇒ Object
- #to_s ⇒ Object
- #to_svg(filename = 'cluster.svg') ⇒ Object
Constructor Details
#initialize(cluster) ⇒ Template
Returns a new instance of Template.
32 33 34 35 36 37 |
# File 'lib/diaspora-cluster-creator/template.rb', line 32 def initialize(cluster) raise RuntimeError unless cluster.respond_to?(:each_node) raise RuntimeError unless cluster.respond_to?(:each_edge) raise RuntimeError unless cluster.respond_to?(:attributes) @cluster = cluster end |
Instance Attribute Details
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
31 32 33 |
# File 'lib/diaspora-cluster-creator/template.rb', line 31 def cluster @cluster end |
Instance Method Details
#to_dot(filename = 'cluster.dot') ⇒ Object
42 43 44 |
# File 'lib/diaspora-cluster-creator/template.rb', line 42 def to_dot(filename = 'cluster.dot') canvas.output(:dot => "#{filename}") end |
#to_png(filename = 'cluster.png') ⇒ Object
45 46 47 |
# File 'lib/diaspora-cluster-creator/template.rb', line 45 def to_png(filename = 'cluster.png') canvas.output(:png => "#{filename}") end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/diaspora-cluster-creator/template.rb', line 39 def to_s canvas.to_s end |
#to_svg(filename = 'cluster.svg') ⇒ Object
48 49 50 |
# File 'lib/diaspora-cluster-creator/template.rb', line 48 def to_svg(filename = 'cluster.svg') canvas.output(:svg => "#{filename}") end |