mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Kill unused Pathname #media_type and #sub_type
This commit is contained in:
@@ -85,30 +85,6 @@ module Linguist
|
|||||||
@mime_type ||= Mime.mime_for(extname)
|
@mime_type ||= Mime.mime_for(extname)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Get the mime media type
|
|
||||||
#
|
|
||||||
# Examples
|
|
||||||
#
|
|
||||||
# Pathname.new('index.html').media_type
|
|
||||||
# # => 'text'
|
|
||||||
#
|
|
||||||
# Returns a media type String.
|
|
||||||
def media_type
|
|
||||||
mime_type.split('/')[0]
|
|
||||||
end
|
|
||||||
|
|
||||||
# Public: Get the mime sub type
|
|
||||||
#
|
|
||||||
# Examples
|
|
||||||
#
|
|
||||||
# Pathname.new('index.html').sub_type
|
|
||||||
# # => 'html'
|
|
||||||
#
|
|
||||||
# Returns a media type String.
|
|
||||||
def sub_type
|
|
||||||
mime_type.split('/')[1]
|
|
||||||
end
|
|
||||||
|
|
||||||
# Public: Get the Content-Type header
|
# Public: Get the Content-Type header
|
||||||
#
|
#
|
||||||
# This value is used when serving raw blobs.
|
# This value is used when serving raw blobs.
|
||||||
|
|||||||
@@ -63,10 +63,4 @@ class TestPathname < Test::Unit::TestCase
|
|||||||
assert_equal 'text/plain; charset=utf-8', Pathname.new("file.rb").content_type
|
assert_equal 'text/plain; charset=utf-8', Pathname.new("file.rb").content_type
|
||||||
assert_equal 'image/png', Pathname.new("octocat.png").content_type
|
assert_equal 'image/png', Pathname.new("octocat.png").content_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_media_type
|
|
||||||
assert_equal 'text', Pathname.new("file.js").media_type
|
|
||||||
assert_equal 'text', Pathname.new("file.txt").media_type
|
|
||||||
assert_equal 'text', Pathname.new("defun.kt").media_type
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user