Class: SVGProfiler::Inkscape

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_profiler/inkscape.rb

Defined Under Namespace

Classes: DependencyError

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Inkscape

Returns a new instance of Inkscape.



3
4
5
6
# File 'lib/svg_profiler/inkscape.rb', line 3

def initialize(xml)
  check_for_inkscape
  @xml = xml
end

Instance Method Details

#heightObject



12
13
14
# File 'lib/svg_profiler/inkscape.rb', line 12

def height
  exec("-H").to_i
end

#widthObject



8
9
10
# File 'lib/svg_profiler/inkscape.rb', line 8

def width
  exec("-W").to_i
end

#yield_png(&block) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/svg_profiler/inkscape.rb', line 16

def yield_png(&block)
  tmp = Tempfile.new(["tmp", ".png"])
  write_png(tmp.path)
  yield tmp
ensure
  tmp.close
  tmp.unlink
end