mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add detection for CSV
This commit is contained in:
@@ -158,6 +158,13 @@ module Linguist
|
|||||||
extname.downcase == '.stl'
|
extname.downcase == '.stl'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Is this blob a CSV file?
|
||||||
|
#
|
||||||
|
# Return true or false
|
||||||
|
def csv?
|
||||||
|
text? && extname.downcase == '.csv'
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Is the blob a PDF?
|
# Public: Is the blob a PDF?
|
||||||
#
|
#
|
||||||
# Return true or false
|
# Return true or false
|
||||||
|
|||||||
3
samples/Text/cars.csv
Normal file
3
samples/Text/cars.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Year,Make,Model,Length
|
||||||
|
1997,Ford,E350,2.34
|
||||||
|
2000,Mercury,Cougar,2.38
|
||||||
|
@@ -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_csv
|
||||||
|
assert blob("Text/cars.csv").csv?
|
||||||
|
end
|
||||||
|
|
||||||
def test_pdf
|
def test_pdf
|
||||||
assert blob("Binary/foo.pdf").pdf?
|
assert blob("Binary/foo.pdf").pdf?
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user