mini_magick 4.9.4 → 4.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mini_magick/image.rb +18 -7
- data/lib/mini_magick/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e2c6af6925e0ecc26c917f270ff575986489977416754ecc89db3bbab04dee
|
4
|
+
data.tar.gz: cac982bbd12f543f637dce9a6fc8ed9e6c2139f7010d9da82f53a510ef2e2525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d841baabdc47d95a763010f113cfbc6d0acdf1ca8894e16c80bb86e307516b0f00da4c55617e5207360e4eb7bbb1e5268f5da62dabd4eb291da3d029354fdf
|
7
|
+
data.tar.gz: 201f2187bedeb2db3157f15f611c026216b083b1e0174c67389a3a157976c0b887e211fc1e6bd2286736f27f04940f6c29586fd00d5079b6c2573e38a1739da4
|
data/lib/mini_magick/image.rb
CHANGED
@@ -82,16 +82,27 @@ module MiniMagick
|
|
82
82
|
def self.open(path_or_url, ext = nil, options = {})
|
83
83
|
options, ext = ext, nil if ext.is_a?(Hash)
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
# Don't use Kernel#open, but reuse its logic
|
86
|
+
openable =
|
87
|
+
if path_or_url.respond_to?(:open)
|
88
|
+
path_or_url
|
89
|
+
elsif path_or_url.respond_to?(:to_str) &&
|
90
|
+
%r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ path_or_url &&
|
91
|
+
(uri = URI.parse(path_or_url)).respond_to?(:open)
|
92
|
+
uri
|
93
|
+
else
|
94
|
+
options = { binmode: true }.merge(options)
|
95
|
+
Pathname(path_or_url)
|
96
|
+
end
|
89
97
|
|
90
|
-
if
|
91
|
-
|
98
|
+
if openable.is_a?(URI::Generic)
|
99
|
+
ext ||= File.extname(openable.path)
|
92
100
|
else
|
93
|
-
File.
|
101
|
+
ext ||= File.extname(openable.to_s)
|
94
102
|
end
|
103
|
+
ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
|
104
|
+
|
105
|
+
openable.open(options) { |file| read(file, ext) }
|
95
106
|
end
|
96
107
|
|
97
108
|
##
|
data/lib/mini_magick/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Johnson
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-07-
|
16
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rake
|