lib/dynamic_image/helper.rb in dynamic_image-3.0.2 vs lib/dynamic_image/helper.rb in dynamic_image-3.0.3

- old
+ new

@@ -24,20 +24,17 @@ # # ==== Examples # # image = Image.find(params[:id]) # dynamic_image_tag(image) - # # => <img alt="My file" height="200" src="..." width="320" /> + # # => <img height="200" src="..." width="320" /> # dynamic_image_tag(image, size: "100x100", alt="Avatar") # # => <img alt="Avatar" height="62" src="..." width="100" /> def dynamic_image_tag(record_or_array, options = {}) - record = extract_dynamic_image_record(record_or_array) - options = { alt: filename_to_alt(record.filename) }.merge(options) - size = fit_size!(record_or_array, options) url_options = options.extract!(*allowed_dynamic_image_url_options) - html_options = { size: size }.merge(options) + html_options = { size: }.merge(options) image_tag(dynamic_image_path_with_size(record_or_array, size, url_options), html_options) @@ -141,11 +138,11 @@ record = extract_dynamic_image_record(record_or_array) options = { routing_type: :url, action: nil, format: default_format_for_image(record), - size: size + size: }.merge(options) options[:digest] = dynamic_image_digest(record, options[:action], options[:size]) polymorphic_url(record_or_array, options) end @@ -177,10 +174,10 @@ end end def image_sizing(record, size_opts, uncropped) ImageSizing - .new(record, uncropped: uncropped) + .new(record, uncropped:) .fit(size_opts[:size], size_opts).floor.to_s end end end