lib/image_processing/chainable.rb in image_processing-1.12.1 vs lib/image_processing/chainable.rb in image_processing-1.12.2
- old
+ new
@@ -32,17 +32,17 @@
# # or
# .apply([[:resize_to_limit, [400, 400]], [:strip, true])
def apply(operations)
operations.inject(self) do |builder, (name, argument)|
if argument == true || argument == nil
- builder.send(name)
+ builder.public_send(name)
elsif argument.is_a?(Array)
- builder.send(name, *argument)
+ builder.public_send(name, *argument)
elsif argument.is_a?(Hash)
- builder.send(name, **argument)
+ builder.public_send(name, **argument)
else
- builder.send(name, argument)
+ builder.public_send(name, argument)
end
end
end
# Add an operation defined by the processor.
@@ -51,10 +51,12 @@
end
# Call the defined processing and get the result. Allows specifying
# the source file and destination.
def call(file = nil, destination: nil, **call_options)
- options = { source: file, destination: destination }.compact
+ options = {}
+ options[:source] = file if file
+ options[:destination] = destination if destination
branch(**options).call!(**call_options)
end
# Creates a new builder object, merging current options with new options.