Class: FastImageParsing::Svg

Inherits:
ImageBase show all
Defined in:
lib/fastimage/fastimage_parsing/svg.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from ImageBase

#animated?, #initialize

Constructor Details

This class inherits a constructor from FastImageParsing::ImageBase

Instance Method Details

#dimensionsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastimage/fastimage_parsing/svg.rb', line 3

def dimensions
  @width, @height, @ratio, @viewbox_width, @viewbox_height = nil

  parse_svg
  
  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