Class: Condenser::SVGTransformer::Base
- Inherits:
-
Object
- Object
- Condenser::SVGTransformer::Base
- Defined in:
- lib/condenser/transformers/svg_transformer/base.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
Instance Method Summary collapse
-
#initialize(escape: nil) ⇒ Base
constructor
A new instance of Base.
- #to_module ⇒ Object
Constructor Details
#initialize(escape: nil) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/condenser/transformers/svg_transformer/base.rb', line 5 def initialize(escape: nil) @children = [] end |
Instance Attribute Details
#children ⇒ Object
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_module ⇒ Object
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 <<~JS export default function (svgAttributes) { #{@children.last.to_js(var_generator: var_generator)} if (svgAttributes) { Object.keys(svgAttributes).forEach(function (key) { __a.setAttribute(key, svgAttributes[key]); }); } return __a; } JS end |