lib/image_processing/chainable.rb in image_processing-0.11.1 vs lib/image_processing/chainable.rb in image_processing-0.11.2
- old
+ new
@@ -27,37 +27,39 @@
block ? operation(:custom, block) : self
end
def method_missing(name, *args)
if name.to_s.end_with?("!")
- send(name.to_s.chomp("!"), *args).call!
+ send(name.to_s.chomp("!"), *args).call
elsif name.to_s.end_with?("?")
super
else
operation(name, *args)
end
end
- def call(file = nil, **call_options)
+ def call(file = nil, destination: nil, **call_options)
options = default_options
options = options.merge(source: file) if file
+ options = options.merge(destination: destination) if destination
branch(options).call!(**call_options)
end
def branch(options)
- options = options.merge(processor: self::Processor) if self.is_a?(Module)
- Pipeline.new(options)
+ options = options.merge(processor_class: self::Processor) unless self.is_a?(Builder)
+
+ Builder.new(options)
end
def default_options
@default_options ||= {
- source: nil,
- loader: {},
- saver: {},
- format: nil,
- operations: [],
- processor: nil,
+ source: nil,
+ loader: {},
+ saver: {},
+ format: nil,
+ operations: [],
+ processor_class: nil,
}
end
end
end