Class: Victor::CLI::SVGSource

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(svg_tree, template: nil) ⇒ SVGSource

Returns a new instance of SVGSource.



9
10
11
12
13
# File 'lib/victor/cli/svg_source.rb', line 9

def initialize(svg_tree, template: nil)
  @svg_tree = svg_tree
  @svg_tree = Parser.new(@svg_tree).parse if @svg_tree.is_a? String
  @template = template || :cli
end

Instance Attribute Details

#svg_treeObject (readonly)

Returns the value of attribute svg_tree.



7
8
9
# File 'lib/victor/cli/svg_source.rb', line 7

def svg_tree
  @svg_tree
end

#templateObject (readonly)

Returns the value of attribute template.



7
8
9
# File 'lib/victor/cli/svg_source.rb', line 7

def template
  @template
end

Instance Method Details

#ruby_codeObject



15
16
17
# File 'lib/victor/cli/svg_source.rb', line 15

def ruby_code
  @ruby_code ||= Rufo::Formatter.format(code_for_node(svg_tree))
end