Class: FastImage::Svg

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Svg

Returns a new instance of Svg.



1004
1005
1006
1007
1008
# File 'lib/fastimage.rb', line 1004

def initialize(stream)
  @stream = stream
  @width, @height, @ratio, @viewbox_width, @viewbox_height = nil
  parse_svg
end

Instance Method Details

#width_and_heightObject



1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'lib/fastimage.rb', line 1010

def width_and_height
  if @width && @height
    [@width, @height]
  elsif @width && @ratio
    [@width, @width / @ratio]
  elsif @height && @ratio
    [@height * @ratio, @height]
  elsif @viewbox_width && @viewbox_height
    [@viewbox_width, @viewbox_height]
  else
    nil
  end
end