Class: Postsvg::Svg::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/postsvg/svg/document.rb

Overview

Root value object produced by Svg::Parser. Carries the SVG root element, the document's viewBox / width / height (parsed once), and the ClipPathRegistry assembled from .

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_element:, viewbox: nil, width: nil, height: nil, clip_paths: ClipPathRegistry.empty) ⇒ Document

Returns a new instance of Document.



11
12
13
14
15
16
17
18
19
# File 'lib/postsvg/svg/document.rb', line 11

def initialize(root_element:, viewbox: nil, width: nil, height: nil,
               clip_paths: ClipPathRegistry.empty)
  @root_element = root_element
  @viewbox = viewbox
  @width = width
  @height = height
  @clip_paths = clip_paths
  freeze
end

Instance Attribute Details

#clip_pathsObject (readonly)

Returns the value of attribute clip_paths.



9
10
11
# File 'lib/postsvg/svg/document.rb', line 9

def clip_paths
  @clip_paths
end

#heightObject (readonly)

Returns the value of attribute height.



9
10
11
# File 'lib/postsvg/svg/document.rb', line 9

def height
  @height
end

#root_elementObject (readonly)

Returns the value of attribute root_element.



9
10
11
# File 'lib/postsvg/svg/document.rb', line 9

def root_element
  @root_element
end

#viewboxObject (readonly)

Returns the value of attribute viewbox.



9
10
11
# File 'lib/postsvg/svg/document.rb', line 9

def viewbox
  @viewbox
end

#widthObject (readonly)

Returns the value of attribute width.



9
10
11
# File 'lib/postsvg/svg/document.rb', line 9

def width
  @width
end