Class: Victor::CLI::CodeGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/victor/cli/code_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(svg_tree, template: nil) ⇒ CodeGenerator

Returns a new instance of CodeGenerator.



8
9
10
11
# File 'lib/victor/cli/code_generator.rb', line 8

def initialize(svg_tree, template: nil)
  @svg_tree = svg_tree
  @template = template || :cli
end

Instance Attribute Details

#svg_treeObject (readonly)

Returns the value of attribute svg_tree.



6
7
8
# File 'lib/victor/cli/code_generator.rb', line 6

def svg_tree
  @svg_tree
end

#templateObject (readonly)

Returns the value of attribute template.



6
7
8
# File 'lib/victor/cli/code_generator.rb', line 6

def template
  @template
end

Instance Method Details

#generateObject



13
14
15
# File 'lib/victor/cli/code_generator.rb', line 13

def generate
  Rufo::Formatter.format(code_for_node(svg_tree))
end