Class: Victor::CLI::SVGSource
- Inherits:
-
Object
- Object
- Victor::CLI::SVGSource
- Defined in:
- lib/victor/cli/svg_source.rb
Instance Attribute Summary collapse
-
#svg_tree ⇒ Object
readonly
Returns the value of attribute svg_tree.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(svg_tree, template: nil) ⇒ SVGSource
constructor
A new instance of SVGSource.
- #ruby_code ⇒ Object
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_tree ⇒ Object (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 |
#template ⇒ Object (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_code ⇒ Object
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 |