image_processing 1.10.1 → 1.10.2

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.

Potentially problematic release.


This version of image_processing might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5141a7684e311666d6a8a91bf74cd791757df4bafe8b989f42c4785aa7bd2bf
4
- data.tar.gz: 2639145e388bf411cbf03559151c12a5eec8757e96b6bd52ae993533e7559781
3
+ metadata.gz: 35a0714b6480895b6fe888e241cf98863604ff22ec5376db0b6d2659eccae9e0
4
+ data.tar.gz: 95155abc03c148170406ffa39b40d2ea681dc7c805e8508cd23e52fc248536e9
5
5
  SHA512:
6
- metadata.gz: aa03273ffdb5d53a8cd944921db4e6359fb198e308373a15618c4c824cbe981e41c40544f7b64f1008175de30d2ea60f92cfb346564f1d4166e164d27759c4af
7
- data.tar.gz: febc2324ceccb4b0fca18c708ad3c2423239fa458065cb74790a574e8149acc6285709d356eb99ec2896611803cc536707b47c1b3b3c68b3067377fb881dffb0
6
+ metadata.gz: 226306b7dde62d707e055c293a584b7c2c77041a827cc35b95407987c39d07aa641cf3d24794029b780366ff8609f286ac0f99415589c7437e1bfbf4cfd81d9e
7
+ data.tar.gz: 2bc5e7ffee362a0ab619f5ec1abf096be8c04a3bec5057ac40707da5bf3ee4eeadfeb84fbed6e47a2a39c9d65b3017922c15b6371353cca35848c99f11aaee80
@@ -1,3 +1,7 @@
1
+ ## 1.10.2 (2020-01-11)
2
+
3
+ * Fix Ruby 2.7 warnings for separation of positional and keyword arguments (@kamipo, @janko)
4
+
1
5
  ## 1.10.1 (2020-01-07)
2
6
 
3
7
  * [vips] Fix compatibility with ruby-vips 2.0.17+ (@janko)
@@ -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
- # Calls the operation to perform the processing. If the operation is
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
- if method_defined?(name)
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)
@@ -1,3 +1,3 @@
1
1
  module ImageProcessing
2
- VERSION = "1.10.1"
2
+ VERSION = "1.10.2"
3
3
  end
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.1
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-07 00:00:00.000000000 Z
11
+ date: 2020-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_magick