Sha256: a32fba1ef41778eed5bdb16fba40b1cc613e8cd25e427246152f2a9bea8dde7d
Contents?: true
Size: 730 Bytes
Versions: 4
Compression:
Stored size: 730 Bytes
Contents
class Prawn::SVG::Elements::Use < Prawn::SVG::Elements::Base def parse require_attributes 'xlink:href' href = attributes['xlink:href'] if href[0..0] != '#' raise SkipElementError, "use tag has an href that is not a reference to an id; this is not supported" end id = href[1..-1] @definition_element = @document.elements_by_id[id] if @definition_element.nil? raise SkipElementError, "no tag with ID '#{id}' was found, referenced by use tag" end @x = attributes['x'] @y = attributes['y'] end def apply if @x || @y add_call_and_enter "translate", distance(@x || 0, :x), -distance(@y || 0, :y) end add_calls_from_element @definition_element end end
Version data entries
4 entries across 4 versions & 1 rubygems