Class: Condenser::SVGTransformer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/condenser/transformers/svg_transformer/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(escape: nil) ⇒ Base



5
6
7
# File 'lib/condenser/transformers/svg_transformer/base.rb', line 5

def initialize(escape: nil)
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



3
4
5
# File 'lib/condenser/transformers/svg_transformer/base.rb', line 3

def children
  @children
end

Instance Method Details

#to_moduleObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/condenser/transformers/svg_transformer/base.rb', line 9

def to_module()
  var_generator = Condenser::SVGTransformer::VarGenerator.new

  "    export default function (svgAttributes) {\n    \#{@children.last.to_js(var_generator: var_generator)}\n        if (svgAttributes) {\n            Object.keys(svgAttributes).forEach(function (key) {\n                __a.setAttribute(key, svgAttributes[key]);\n            });\n        }\n\n        return __a;\n    }\n  JS\nend\n"