Module: Diaspora::Cluster::Creator

Defined in:
lib/diaspora-cluster-creator.rb,
lib/diaspora-cluster-creator/node.rb,
lib/diaspora-cluster-creator/cluster.rb,
lib/diaspora-cluster-creator/version.rb,
lib/diaspora-cluster-creator/template.rb,
lib/diaspora-cluster-creator/attribute.rb,
lib/diaspora-cluster-creator/fate_dice.rb,
lib/diaspora-cluster-creator/guarantor.rb,
lib/diaspora-cluster-creator/conversions.rb,
lib/diaspora-cluster-creator/node_attribute.rb,
lib/diaspora-cluster-creator/edge_collection_factory.rb,
lib/diaspora-cluster-creator/node_collection_factory.rb,
lib/diaspora-cluster-creator/attribute_collection_factory.rb

Defined Under Namespace

Modules: Conversions Classes: Attribute, AttributeCollectionFactory, Cluster, EdgeCollectionFactory, FateDice, Guarantor, Node, NodeAttribute, NodeCollectionFactory, Template

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/diaspora-cluster-creator.rb', line 6

def self.run(params)
  filename = params[:filename].to_s
  names = ('A'..'Z').to_a[0,params[:count] || 6]

  cluster = Cluster.new(params[:names] || names, params[:attributes])
  template = Template.new(cluster)

  case File.extname(filename)
  when '.dot' then template.to_dot(params[:filename])
  when '.png' then template.to_png(params[:filename])
  when '.svg' then template.to_svg(params[:filename])
  else
    STDOUT.write template.to_s
  end
end