image_processing 1.10.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of image_processing might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/image_processing/chainable.rb +4 -1
- data/lib/image_processing/mini_magick.rb +2 -2
- data/lib/image_processing/processor.rb +18 -10
- data/lib/image_processing/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: 35a0714b6480895b6fe888e241cf98863604ff22ec5376db0b6d2659eccae9e0
|
4
|
+
data.tar.gz: 95155abc03c148170406ffa39b40d2ea681dc7c805e8508cd23e52fc248536e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 226306b7dde62d707e055c293a584b7c2c77041a827cc35b95407987c39d07aa641cf3d24794029b780366ff8609f286ac0f99415589c7437e1bfbf4cfd81d9e
|
7
|
+
data.tar.gz: 2bc5e7ffee362a0ab619f5ec1abf096be8c04a3bec5057ac40707da5bf3ee4eeadfeb84fbed6e47a2a39c9d65b3017922c15b6371353cca35848c99f11aaee80
|
data/CHANGELOG.md
CHANGED
@@ -32,6 +32,8 @@ module ImageProcessing
|
|
32
32
|
builder.send(name)
|
33
33
|
elsif argument.is_a?(Array)
|
34
34
|
builder.send(name, *argument)
|
35
|
+
elsif argument.is_a?(Hash)
|
36
|
+
builder.send(name, **argument)
|
35
37
|
else
|
36
38
|
builder.send(name, argument)
|
37
39
|
end
|
@@ -46,6 +48,7 @@ module ImageProcessing
|
|
46
48
|
|
47
49
|
operation(name, *args, &block)
|
48
50
|
end
|
51
|
+
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
|
49
52
|
|
50
53
|
# Add an operation defined by the processor.
|
51
54
|
def operation(name, *args, &block)
|
@@ -59,7 +62,7 @@ module ImageProcessing
|
|
59
62
|
options = options.merge(source: file) if file
|
60
63
|
options = options.merge(destination: destination) if destination
|
61
64
|
|
62
|
-
branch(options).call!(**call_options)
|
65
|
+
branch(**options).call!(**call_options)
|
63
66
|
end
|
64
67
|
|
65
68
|
# Creates a new builder object, merging current options with new options.
|
@@ -32,7 +32,7 @@ module ImageProcessing
|
|
32
32
|
source_path = path_or_magick
|
33
33
|
magick = ::MiniMagick::Tool::Convert.new
|
34
34
|
|
35
|
-
Utils.apply_options(magick, options)
|
35
|
+
Utils.apply_options(magick, **options)
|
36
36
|
|
37
37
|
input = source_path
|
38
38
|
input = "#{loader}:#{input}" if loader
|
@@ -50,7 +50,7 @@ module ImageProcessing
|
|
50
50
|
# the result to disk. Accepts additional options related to saving the
|
51
51
|
# image (e.g. quality).
|
52
52
|
def self.save_image(magick, destination_path, allow_splitting: false, **options)
|
53
|
-
Utils.apply_options(magick, options)
|
53
|
+
Utils.apply_options(magick, **options)
|
54
54
|
|
55
55
|
magick << destination_path
|
56
56
|
magick.call
|
@@ -34,19 +34,12 @@ module ImageProcessing
|
|
34
34
|
const_set(:ACCUMULATOR_CLASS, klass)
|
35
35
|
end
|
36
36
|
|
37
|
-
#
|
38
|
-
# defined on the processor (macro), calls it. Otherwise calls the
|
39
|
-
# operation directly on the accumulator object. This provides a common
|
40
|
-
# umbrella above defined macros and direct operations.
|
37
|
+
# Delegates to #apply_operation.
|
41
38
|
def self.apply_operation(accumulator, (name, args, block))
|
42
|
-
|
43
|
-
instance = new(accumulator)
|
44
|
-
instance.public_send(name, *args, &block)
|
45
|
-
else
|
46
|
-
accumulator.send(name, *args, &block)
|
47
|
-
end
|
39
|
+
new(accumulator).apply_operation(name, *args, &block)
|
48
40
|
end
|
49
41
|
|
42
|
+
# Whether the processor supports resizing the image upon loading.
|
50
43
|
def self.supports_resize_on_load?
|
51
44
|
false
|
52
45
|
end
|
@@ -55,6 +48,21 @@ module ImageProcessing
|
|
55
48
|
@accumulator = accumulator
|
56
49
|
end
|
57
50
|
|
51
|
+
# Calls the operation to perform the processing. If the operation is
|
52
|
+
# defined on the processor (macro), calls the method. Otherwise calls the
|
53
|
+
# operation directly on the accumulator object. This provides a common
|
54
|
+
# umbrella above defined macros and direct operations.
|
55
|
+
def apply_operation(name, *args, &block)
|
56
|
+
receiver = respond_to?(name) ? self : @accumulator
|
57
|
+
|
58
|
+
if args.last.is_a?(Hash)
|
59
|
+
kwargs = args.pop
|
60
|
+
receiver.public_send(name, *args, **kwargs, &block)
|
61
|
+
else
|
62
|
+
receiver.public_send(name, *args, &block)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
# Calls the given block with the accumulator object. Useful for when you
|
59
67
|
# want to access the accumulator object directly.
|
60
68
|
def custom(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|