Class: SvgDocument
Defined Under Namespace
Modules: HasBounds, HasTranslation Classes: Base, Group, Image, Path, Rectangle
Instance Method Summary collapse
- #find_group_by_label(label) ⇒ Object
-
#initialize(xml_string) ⇒ SvgDocument
constructor
A new instance of SvgDocument.
Constructor Details
#initialize(xml_string) ⇒ SvgDocument
Returns a new instance of SvgDocument.
7 8 9 10 |
# File 'lib/gamebox/core/svg_document.rb', line 7 def initialize(xml_string) @document = REXML::Document.new(xml_string) @root = @document.root end |
Instance Method Details
#find_group_by_label(label) ⇒ Object
12 13 14 15 16 |
# File 'lib/gamebox/core/svg_document.rb', line 12 def find_group_by_label(label) g = REXML::XPath.first(@root, "//g[@inkscape:label='#{label}']") return nil unless g Group.new(g) end |