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.



988
989
990
991
992
# File 'lib/fastimage.rb', line 988

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

Instance Method Details

#width_and_heightObject



994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
# File 'lib/fastimage.rb', line 994

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