Add PDF detection

This commit is contained in:
Garen Torikian
2013-03-25 15:45:58 -07:00
parent 009bff6cc2
commit 4148ff1c29
2 changed files with 11 additions and 0 deletions

View File

@@ -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?

View File

@@ -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?