dragonfly_svg 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92bc94aeb68fd9cc8fbf967c27b7ace7a7778472a6c641462fa67cf7b9f74f6d
4
- data.tar.gz: deb2869aba9c2fc76f5400df0783cc971f6a7b56cabed5ffe3aebdb819bad8ab
3
+ metadata.gz: 523e0e029765f89106d5ebe4c6f9e8763081102969ed6281a64933b1ff0474ee
4
+ data.tar.gz: ffc4473d9511ef375334762116587de492821ceac31450193ddedd5a19a9e413
5
5
  SHA512:
6
- metadata.gz: 165deab9c210352a43e7972ec5f44f4a54cfde88bf10d68f98129340c1015243eb4a31dfbdf869aef9a5fb192660210af427c7371e3209522f994c9e7d5ed18e
7
- data.tar.gz: 50a51b640787b72c1b9badd203183494c629dce7fcffb217c4b5fa95b2db682ce96214b12768fb774d43d87e9a9b85e08a697a4b93b2eb934345743457822b29
6
+ metadata.gz: fbeb5215c375a1fe99eac7f51a1a9298204d76ba75f287e5f2bc04b33795a3c423cc8a7c699de56e3855d12a26f404ac321ce7cdc8355bc380b43f032a1d8b79
7
+ data.tar.gz: cf6ca544b60e6eb83991f10df5ccbe80a7d64b0ab8164a82571becc5d84b204ba3949e5b4fa8efa586b7d78ee971a4b7119f03b20b8e08aeaa5ed1a23a270ade
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.1
4
+
5
+ * improved `SUPPORTED_FORMATS` matching that ignores case
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  * add `SUPPORTED_FORMATS` and raise errors when formats are not matching
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Analysers
5
5
  class SvgProperties
6
6
  def call(content)
7
- return {} unless SUPPORTED_FORMATS.include?(content.ext)
7
+ return {} unless content.ext
8
+ return {} unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
  return {} unless doc = Nokogiri::XML(content.data)
9
10
  return {} unless node = doc.xpath("//*[name()='svg']").first
10
11
 
@@ -5,7 +5,8 @@ module DragonflySvg
5
5
  module Processors
6
6
  class ExtendIds
7
7
  def call(content, append_str = SecureRandom.urlsafe_base64(8), options = {})
8
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
8
+ raise UnsupportedFormat unless content.ext
9
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
9
10
 
10
11
  doc = Nokogiri::XML(content.data)
11
12
 
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Processors
5
5
  class RemoveNamespaces
6
6
  def call(content)
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
 
9
10
  doc = Nokogiri::XML(content.data)
10
11
  doc.remove_namespaces!
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetAttribute
6
6
  def call(content, xpath, attribute_name, value)
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
 
9
10
  doc = Nokogiri::XML(content.data)
10
11
  doc.xpath(xpath).each do |node|
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetDimensions
6
6
  def call(content, width, height)
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
 
9
10
  SetAttribute.new.call(content, "//*[name()='svg']", 'width', width) if width
10
11
  SetAttribute.new.call(content, "//*[name()='svg']", 'height', height) if height
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetNamespace
6
6
  def call(content, namespace = 'http://www.w3.org/2000/svg')
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
 
9
10
  doc = Nokogiri::XML(content.data)
10
11
 
@@ -4,8 +4,9 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetPreserveAspectRatio
6
6
  def call(content, value = 'xMinYMin meet')
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
8
-
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
9
+
9
10
  SetAttribute.new.call(content, "//*[name()='svg']", 'preserveAspectRatio', value)
10
11
  end
11
12
  end
@@ -4,7 +4,8 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetTagValue
6
6
  def call(content, xpath, value)
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
8
9
 
9
10
  doc = Nokogiri::XML(content.data)
10
11
  doc.xpath(xpath).each do |node|
@@ -4,8 +4,9 @@ module DragonflySvg
4
4
  module Processors
5
5
  class SetViewBox
6
6
  def call(content, min_x, min_y, width, height)
7
- raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
8
-
7
+ raise UnsupportedFormat unless content.ext
8
+ raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
9
+
9
10
  value = [min_x, min_y, width, height].map(&:to_s).join(' ')
10
11
  SetAttribute.new.call(content, "//*[name()='svg']", 'viewBox', value)
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module DragonflySvg
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly_svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-14 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dragonfly