svg-inline-file-extractor 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 888573bbff4197b7367935f7046277b4a919c2c7
4
- data.tar.gz: 8af30e3cc69c4c7d99c97ef37f988fb6aeeeb754
3
+ metadata.gz: 0feae27fb66bafc1a0c95732d827ddf71b77de1b
4
+ data.tar.gz: 3baa5d724f218bf1306b0233eed38f92b0db94c2
5
5
  SHA512:
6
- metadata.gz: d511746ed7324e4c13ecbaee11602d1e0dea95bf665bf7f632db5abc67c66b57e3794aa932912e86e60cfa6122a98f9ce031a8169d5c2946679c78c9e733edd7
7
- data.tar.gz: e791067aa2c534f3adb2ebd1de5b8a9bd8373ae665f7b94a6e2618e834af0c3a3bcfe660fa420d31cd546abeb540a41a5c672c31c469ac7fc750b340b0ac634e
6
+ metadata.gz: bc98bbe216a2720b9ada047d1e55453933399668bd0c8e8dbba26d15c07b1a494d3d8d4417afda4a339da9bdc20e6c0d95cb19aa139d538339ffb7bc899cd800
7
+ data.tar.gz: 540f23bdea3008b93b15f9e03e497343296250f34b046a876d3183bfc188816e3b54f8eb5f3662609ad05dd610441766be42f65198e9eb67981716420f2fa4b0
@@ -23,12 +23,14 @@ module SvgInlineFileExtractor
23
23
  @declared_image_type ||= begin
24
24
  if (match = href_contents.match(DATA_IMAGE_HEADER_PATTERN))
25
25
  match[:type]
26
- else
27
- raise UnableToDetermineImageTypeError, "Unable to match header to #{DATA_IMAGE_HEADER_PATTERN}"
28
26
  end
29
27
  end
30
28
  end
31
29
 
30
+ def inline_image?
31
+ !!declared_image_type
32
+ end
33
+
32
34
  # @return [ String | nil ] the value of the id attribute in the parent element
33
35
  def element_id
34
36
  @element_id ||= get_attribute('id')
@@ -41,8 +41,10 @@ module SvgInlineFileExtractor
41
41
  # @see InlineImage
42
42
  def inline_images
43
43
  image_elements.map do |element|
44
- InlineImage.new(element)
45
- end
44
+ if (image = InlineImage.new(element)).inline_image?
45
+ image
46
+ end
47
+ end.compact
46
48
  end
47
49
 
48
50
  private
@@ -1,3 +1,3 @@
1
1
  module SvgInlineFileExtractor
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svg-inline-file-extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Boie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.12'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.12'
97
97
  description:
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
107
  - CODE_OF_CONDUCT.md
108
108
  - Gemfile
109
109
  - LICENSE
@@ -125,17 +125,17 @@ require_paths:
125
125
  - lib
126
126
  required_ruby_version: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: 2.0.0
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.0.14
138
+ rubygems_version: 2.5.1
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Extract inline SVG base64 encoded images, and other inline files.