Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
halostatue committed Oct 2, 2024
1 parent 194dc97 commit 428afcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .hoerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
exclude: !ruby/regexp '/
\.(?:
tmp
| swp
tmp |
swp
)$
|
\.(?:
Expand All @@ -18,7 +18,8 @@ exclude: !ruby/regexp '/
[gG]emfile(?:\.lock)?
|
(?:
support
support |
research
)\/
|
\b(?i:TAGS)$
Expand Down
4 changes: 2 additions & 2 deletions lib/mime/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/mime/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 428afcb

Please sign in to comment.