Skip to content

Commit

Permalink
Add detection for CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
sshirokov committed Apr 4, 2013
1 parent b99abba commit b68732f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/linguist/blob_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ def solid?
extname.downcase == '.stl'
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?
#
# Return true or false
Expand Down
3 changes: 3 additions & 0 deletions samples/Text/cars.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
4 changes: 4 additions & 0 deletions test/test_blob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ def test_solid
assert blob("Text/cube.stl").solid?
end

def test_csv
assert blob("Text/cars.csv").csv?
end

def test_pdf
assert blob("Binary/foo.pdf").pdf?
end
Expand Down

0 comments on commit b68732f

Please sign in to comment.