Commit de693b41 by Chris Ell

Use Hash#fetch to standardize Thumbnail instance variable assignment

parent 9ee29f36
...@@ -31,14 +31,14 @@ module Paperclip ...@@ -31,14 +31,14 @@ module Paperclip
geometry = options[:geometry] # this is not an option geometry = options[:geometry] # this is not an option
@file = file @file = file
@crop = geometry[-1,1] == '#' @crop = geometry[-1,1] == '#'
@target_geometry = (options[:string_geometry_parser] || Geometry).parse(geometry) @target_geometry = options.fetch(:string_geometry_parser, Geometry).parse(geometry)
@current_geometry = (options[:file_geometry_parser] || Geometry).from_file(@file) @current_geometry = options.fetch(:file_geometry_parser, Geometry).from_file(@file)
@source_file_options = options[:source_file_options] @source_file_options = options[:source_file_options]
@convert_options = options[:convert_options] @convert_options = options[:convert_options]
@whiny = options[:whiny].nil? ? true : options[:whiny] @whiny = options.fetch(:whiny, true)
@format = options[:format] @format = options[:format]
@animated = options[:animated].nil? ? true : options[:animated] @animated = options.fetch(:animated, true)
@auto_orient = options[:auto_orient].nil? ? true : options[:auto_orient] @auto_orient = options.fetch(:auto_orient, true)
if @auto_orient && @current_geometry.respond_to?(:auto_orient) if @auto_orient && @current_geometry.respond_to?(:auto_orient)
@current_geometry.auto_orient @current_geometry.auto_orient
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment