svg2img 0.2.0-x86_64-linux → 0.2.1-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -3
  3. data/lib/svg2img/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb45feae53bf81f067ebf6594892164044ee6c892406d5bef31ff651294ae2ba
4
- data.tar.gz: f2336c48fc8487b51e322194ebd7ec1cd1064b9e4c07521f9c437547812ebd3e
3
+ metadata.gz: dd2a88cff4273183b133797dc4beb262dcc41dc62470064321a7d166f4fe7d1d
4
+ data.tar.gz: 4bb645629d0c46e7e2db34fa556e5c2f1240858722b0c20895b16126ff96c9b7
5
5
  SHA512:
6
- metadata.gz: c90f8f7858bb5f8d46325c6f1c516449c19769f00467a1a65387e2de9a8ead140fcec6f4e7ac2105bc9b2ea01aade8efee38120ce67d23fca1f97061da39679f
7
- data.tar.gz: c3f89496e7cc5ae490630468e549ade5354ce37eed37b4cb8529497a7b471191cbd44594071e0774841ee337b743197d2ee4c8fce166db4afeb1a6309be786cb
6
+ metadata.gz: 31c3bf5f8b12d06fe3aa21a14646c9e38519074212b5b1c396829b3ede75df03796bf09ec5b47cd044aa428659a9f799f9e0d20299e6a8002cb39b484c51eea5
7
+ data.tar.gz: bd115d7a1dc3156ae96b47b73bd0be4464690039cf771010b6a1f2532fde14c2e1c46fb725fdc5a5cc6e9a998b85c1aea0eb6de315a8a4a3c9b1fb324a448fb9
data/README.md CHANGED
@@ -40,6 +40,11 @@ bundle lock --add-platform arm64-darwin # Apple Silicon MacOS (i.e. M1)
40
40
 
41
41
  ## Usage
42
42
 
43
+ ```ruby
44
+ require "svg2img"
45
+ Svg2Img.process_svg(svg_string, options)
46
+ ```
47
+
43
48
  Example usage:
44
49
 
45
50
  ```ruby
@@ -50,12 +55,12 @@ circle_svg = <<~SVG
50
55
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
51
56
  </svg>
52
57
  SVG
53
- png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
58
+ png_path = Svg2Img.process_svg(circle_svg, format: :png)
54
59
  # png_path is a path to the generated PNG file
55
60
 
56
61
  # Rails example
57
62
  data = Rails.cache.fetch([some, deps]) do
58
- png_path = Svg2Img.process_svg(circle_svg, output_format: :png, size: proc {|_svg_width, _svg_height| [256, 256]})
63
+ png_path = Svg2Img.process_svg(circle_svg, format: :png, size: proc {|_svg_width, _svg_height| [256, 256]})
59
64
  png_data = File.binread(png_path)
60
65
  File.delete(png_path)
61
66
  png_data
@@ -65,7 +70,8 @@ send_data(png_data, type: 'image/png', disposition: 'inline')
65
70
 
66
71
  ### Options
67
72
 
68
- - `output_format` - output format, one of `:png`, `:jpg`, `:webp`, `:gif`
73
+ - `format` - output format, one of `:png`, `:jpg`, `:webp`, `:gif`
74
+ - `output_path` - path to the output image. If not provided, a temporary file will be created and the path to it will be returned.
69
75
  - `size` - size of the output image as a proc that receives the width and height of the SVG and returns an array with the width and height of the output image. If the provides size has a different aspect ratio than the SVG, the image will be resized to fit in the center of the provided size. If not provided, the output image will have the same size as the SVG.
70
76
 
71
77
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Svg2Img
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svg2img
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Orvar Segerström