lib/dynamic_image/helper.rb in dynamic_image-2.0.16 vs lib/dynamic_image/helper.rb in dynamic_image-2.0.17
- old
+ new
@@ -1,6 +1,6 @@
-# encoding: utf-8
+# frozen_string_literal: true
module DynamicImage
# = DynamicImage Helper
#
# Provides helper methods for rendering and linking to images.
@@ -115,15 +115,13 @@
end
private
def allowed_dynamic_image_url_options
- [
- :format, :only_path, :protocol, :host, :subdomain, :domain,
- :tld_length, :port, :anchor, :trailing_slash, :script_name,
- :action, :routing_type
- ]
+ %i[format only_path protocol host subdomain domain
+ tld_length port anchor trailing_slash script_name
+ action routing_type ]
end
def default_format_for_image(record)
Mime::Type.lookup(record.safe_content_type).to_sym
end
@@ -160,12 +158,12 @@
record_or_array
end
end
def filename_to_alt(str)
- File.basename(str, ".*".freeze)
- .sub(/-[[:xdigit:]]{32,64}\z/, "".freeze)
- .tr("-_".freeze, " ".freeze)
+ File.basename(str, ".*")
+ .sub(/-[[:xdigit:]]{32,64}\z/, "")
+ .tr("-_", " ")
.capitalize
end
def fit_size!(record_or_array, options)
record = extract_dynamic_image_record(record_or_array)