Class: FastImage::Svg

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Svg



714
715
716
717
718
# File 'lib/fastimage.rb', line 714

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

Instance Method Details

#width_and_heightObject



720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/fastimage.rb', line 720

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