Class: SVGProfiler

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

Defined Under Namespace

Classes: Histogram, Inkscape

Instance Method Summary collapse

Constructor Details

#initialize(xml_string) ⇒ SVGProfiler

Returns a new instance of SVGProfiler.



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

def initialize(xml_string)
  @xml_string = xml_string
  @inkscape = Inkscape.new(xml_string)
end

Instance Method Details

#aspectObject



20
21
22
# File 'lib/svg_profiler/base.rb', line 20

def aspect
  width.to_f / height
end

#dimensionsObject



16
17
18
# File 'lib/svg_profiler/base.rb', line 16

def dimensions
  [width, height]
end

#heightObject



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

def height
  @inkscape.height
end

#histogramObject



24
25
26
# File 'lib/svg_profiler/base.rb', line 24

def histogram
  @inkscape.yield_png { |png| Histogram.for(@xml_string, png) }
end

#widthObject



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

def width
  @inkscape.width
end