class DragonflyHarfbuzz::TranslateService
Attributes
ox_doc[RW]
svg[RW]
x[RW]
y[RW]
Public Class Methods
call(*args)
click to toggle source
# File lib/dragonfly_harfbuzz/translate_service.rb, line 10 def self.call(*args) new(*args).call end
new(svg, x: 0, y: 0)
click to toggle source
# File lib/dragonfly_harfbuzz/translate_service.rb, line 14 def initialize(svg, x: 0, y: 0) @svg = svg @x = x.to_f @y = y.to_f @ox_doc = Ox.parse(svg) end
Public Instance Methods
call()
click to toggle source
# File lib/dragonfly_harfbuzz/translate_service.rb, line 21 def call use_definitions.each do |use_definition| use_definition[:x] = use_definition[:x].to_f + x use_definition[:y] = use_definition[:y].to_f + y end Ox.dump(ox_doc) end
Private Instance Methods
use_definitions()
click to toggle source
# File lib/dragonfly_harfbuzz/translate_service.rb, line 32 def use_definitions ox_doc.locate('svg/g/g/use[@xlink:href]') end