Class: Diaspora::Cluster::Creator::Template

Inherits:
Object
  • Object
show all
Includes:
Conversions
Defined in:
lib/diaspora-cluster-creator/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster) ⇒ Template

Returns a new instance of Template.

Raises:

  • (RuntimeError)


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

#clusterObject (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_sObject



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