mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add PDF detection
This commit is contained in:
@@ -158,6 +158,13 @@ module Linguist
|
|||||||
extname.downcase == '.stl'
|
extname.downcase == '.stl'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Is the blob a PDF?
|
||||||
|
#
|
||||||
|
# Return true or false
|
||||||
|
def pdf?
|
||||||
|
extname.downcase == '.pdf'
|
||||||
|
end
|
||||||
|
|
||||||
MEGABYTE = 1024 * 1024
|
MEGABYTE = 1024 * 1024
|
||||||
|
|
||||||
# Public: Is the blob too big to load?
|
# Public: Is the blob too big to load?
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("Text/cube.stl").solid?
|
assert blob("Text/cube.stl").solid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pdf
|
||||||
|
assert blob("Binary/foo.pdf").pdf?
|
||||||
|
end
|
||||||
|
|
||||||
def test_viewable
|
def test_viewable
|
||||||
assert blob("Text/README").viewable?
|
assert blob("Text/README").viewable?
|
||||||
assert blob("Ruby/foo.rb").viewable?
|
assert blob("Ruby/foo.rb").viewable?
|
||||||
|
|||||||
Reference in New Issue
Block a user