Allow selecting image type via Regexp
All checks were successful
continuous-integration/drone/push Build is passing

For example, SVG images might be of type "image/svg" or "image/svg+xml"
This commit is contained in:
2024-08-14 16:12:28 +02:00
parent 339508bf41
commit 17883b7b6c
2 changed files with 17 additions and 1 deletions

View File

@@ -43,7 +43,13 @@ module Manifique
end
if options[:type]
results.reject! { |r| r["type"] != options[:type] }
if options[:type].is_a?(String)
results.reject! { |r| r["type"] != options[:type] }
elsif options[:type].is_a?(Regexp)
results.reject! { |r| r["type"].match(options[:type]).nil? }
else
raise ArgumentError, "Type must be a string or a regular expression"
end
end
if options[:sizes]