Class: FastImage::Svg
- Inherits:
-
Object
- Object
- FastImage::Svg
- Defined in:
- lib/fastimage.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(stream) ⇒ Svg
constructor
A new instance of Svg.
- #width_and_height ⇒ Object
Constructor Details
#initialize(stream) ⇒ Svg
Returns a new instance of Svg.
1031 1032 1033 1034 1035 |
# File 'lib/fastimage.rb', line 1031 def initialize(stream) @stream = stream @width, @height, @ratio, @viewbox_width, @viewbox_height = nil parse_svg end |
Instance Method Details
#width_and_height ⇒ Object
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
# File 'lib/fastimage.rb', line 1037 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 |