aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-08-20 11:14:45 -0500
committerJoshua Peek <josh@joshpeek.com>2012-08-20 11:14:45 -0500
commit620150d1880347fabda218b6edaf6611725cfe9a (patch)
tree8306e557cdda3702ce9301209aa650219b78a6b6 /lib
parent630dca515a16b23ecf2e14b909f5491361b6f41d (diff)
Only double check with binary mime type when lazy loading blob
Diffstat (limited to 'lib')
-rw-r--r--lib/linguist/blob_helper.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb
index 2c80346..f8a4cfb 100644
--- a/lib/linguist/blob_helper.rb
+++ b/lib/linguist/blob_helper.rb
@@ -259,11 +259,9 @@ module Linguist
#
# Returns a Language or nil if none is detected
def language
- if defined? @language
- @language
- elsif !binary_mime_type?
- @language = Language.detect(name.to_s, lambda { data }, mode)
- end
+ return @language if defined? @language
+ data_loader = lambda { binary_mime_type? ? "" : data }
+ @language = Language.detect(name.to_s, data_loader, mode)
end
# Internal: Get the lexer of the blob.