Sha256: 8601cc4fa2a13f008207374eb5f47195ad2f5c20fcfca03cd6748ecfb65acf18
Contents?: true
Size: 491 Bytes
Versions: 1
Compression:
Stored size: 491 Bytes
Contents
module Grit class Blob def text? !!(mime_type =~ /application|text/ && !binary?) end def image? !!(mime_type =~ /image/) end def binary? data[0..1024].include?("\000") end def encoding if detection = CharlockHolmes::EncodingDetector.detect(data) detection[:encoding] end end def language if lang = LanguageSniffer.detect(basename, :content => data).language lang.name end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grit_ext-0.1.0 | lib/grit_ext/blob.rb |