diff --git a/.hoerc b/.hoerc index 0d0aae2..55c87d2 100644 --- a/.hoerc +++ b/.hoerc @@ -1,8 +1,8 @@ --- exclude: !ruby/regexp '/ \.(?: - tmp - | swp + tmp | + swp )$ | \.(?: @@ -18,7 +18,8 @@ exclude: !ruby/regexp '/ [gG]emfile(?:\.lock)? | (?: - support + support | + research )\/ | \b(?i:TAGS)$ diff --git a/lib/mime/type.rb b/lib/mime/type.rb index 23036d5..259af18 100644 --- a/lib/mime/type.rb +++ b/lib/mime/type.rb @@ -187,8 +187,8 @@ def like?(other) # Compares the +other+ MIME::Type against the exact content type or the # simplified type (the simplified type will be used if comparing against - # something that can be treated as a String with #to_s). In comparisons, - # this is done against the lowercase version of the MIME::Type. + # something that can be treated as a String with #to_s). In comparisons, this + # is done against the lowercase version of the MIME::Type. # # Note that this implementation of #<=> is deprecated and will be changed # in the next major version to be the same as #priority_compare. diff --git a/lib/mime/types.rb b/lib/mime/types.rb index a632a0b..ab891f0 100644 --- a/lib/mime/types.rb +++ b/lib/mime/types.rb @@ -152,9 +152,9 @@ def [](type_id, complete: false, registered: false) # => [application/xml, image/gif, text/xml] def type_for(filename) Array(filename).flat_map { |fn| - @extension_index[fn.chomp.downcase[/\.?([^.]*?)\z/, 1]] + @extension_index[fn.chomp.downcase[/\.?([^.]*?)\z/m, 1]] }.compact.inject(Set.new, :+).sort { |a, b| - by_ext = a.extension_priority(*extensions) <=> b.extension_priority(*extensions) + by_ext = a.extension_priority(*a.extensions) <=> b.extension_priority(*b.extensions) if by_ext.zero? a.priority_compare(b)