svg2img 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de0740246d54ec255957288f9b6c9b1172ebc4e71f47b0db7345c5fd056ef53b
4
- data.tar.gz: 06bfff85662695734fca72b86678bab6d05dc2f637e867e009c8e559e4a2fe24
3
+ metadata.gz: 3d79ded4df5c7da3f90781d4a55545909261183b4ab6759baf2e20094ca48011
4
+ data.tar.gz: d2bb132f2fa76a9f7e2754d37615afe67f111cb9e96b2534e298233620d21c05
5
5
  SHA512:
6
- metadata.gz: e791657a53c9d5acec86f010c23f599a4d2f27ac8caba0b580d889334cf07639a07c3db96024916ecab654b122236aac8bc401d2c0d8df91a7f92a658f22046f
7
- data.tar.gz: 2e7dc4a5963186220882042d0731eeef7a8579f5cf1f0d548e1b3fed02d7ac58424abb34131505ab7e55fd42e5606b827f6288a89108a83f5ef0ee09eaa4241e
6
+ metadata.gz: ee228f18a63c3b04969e8b3188b5b3a0c9b9a1a0c8cd3b89d0a8485e87ef27490aebe39cf9ef22944a8185a9540086569d0402b0b4da570a579289740dfbb706
7
+ data.tar.gz: 06dc50fca47cce15698f4f1ab07b9d794986e3f141ba077586916a3e64c4afd7c84bd10655bb7af702da2f8f20dbb75619ed7d934bada4aa8dad35d7d138eb1e
data/README.md CHANGED
@@ -52,6 +52,15 @@ circle_svg = <<~SVG
52
52
  SVG
53
53
  png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
54
54
  # png_path is a path to the generated PNG file
55
+
56
+ # Rails example
57
+ data = Rails.cache.fetch([some, deps]) do
58
+ png_path = Svg2Img.process_svg(circle_svg, output_format: :png)
59
+ png_data = File.binread(png_path)
60
+ File.delete(png_path)
61
+ png_data
62
+ end
63
+ send_data(png_data, type: 'image/png', disposition: 'inline')
55
64
  ```
56
65
 
57
66
  ## Development
@@ -62,7 +71,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
62
71
 
63
72
  ## Contributing
64
73
 
65
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/svg2img.
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/0rvar/svg2img-rb.
66
75
 
67
76
  ## License
68
77
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Svg2Img
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/svg2img.rb CHANGED
@@ -1,7 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "svg2img/version"
4
- require_relative "svg2img/svg2img"
4
+
5
+ begin
6
+ RUBY_VERSION =~ /(\d+\.\d+)/
7
+ require "svg2img/#{Regexp.last_match(1)}/svg2img"
8
+ rescue LoadError
9
+ require 'svg2img/svg2img'
10
+ end
11
+
5
12
 
6
13
  module Svg2Img
7
14
  class Error < StandardError; end