Class: SVGProfiler::Inkscape
- Inherits:
-
Object
- Object
- SVGProfiler::Inkscape
- Defined in:
- lib/svg_profiler/inkscape.rb
Defined Under Namespace
Classes: DependencyError
Instance Method Summary collapse
- #height ⇒ Object
-
#initialize(xml) ⇒ Inkscape
constructor
A new instance of Inkscape.
- #width ⇒ Object
- #yield_png(&block) ⇒ Object
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
#height ⇒ Object
12 13 14 |
# File 'lib/svg_profiler/inkscape.rb', line 12 def height exec("-H").to_i end |
#width ⇒ Object
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 |