Allow selecting image type via Regexp
All checks were successful
continuous-integration/drone/push Build is passing
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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user