Class: Svgeez::Elements::SymbolElement
- Inherits:
-
Object
- Object
- Svgeez::Elements::SymbolElement
- Defined in:
- lib/svgeez/elements/symbol_element.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(file_path, file_id) ⇒ SymbolElement
constructor
A new instance of SymbolElement.
Constructor Details
#initialize(file_path, file_id) ⇒ SymbolElement
Returns a new instance of SymbolElement.
4 5 6 7 |
# File 'lib/svgeez/elements/symbol_element.rb', line 4 def initialize(file_path, file_id) @file_path = file_path @file_id = file_id end |
Instance Method Details
#build ⇒ Object
9 10 11 12 13 |
# File 'lib/svgeez/elements/symbol_element.rb', line 9 def build IO.read(@file_path).match(%r{^<svg\s*?(?<attributes>.*?)>(?<content>.*?)</svg>}m) do |matches| %(<symbol #{element_attributes(matches[:attributes]).sort.join(' ')}>#{element_contents(matches[:content])}</symbol>) end end |