diff --git a/README.md b/README.md index c433899b..7f2b3a2e 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,9 @@ Most languages are detected by their file extension. This is the fastest and mos In the actual GitHub app we deal with `Grit::Blob` objects. For testing, there is a simple `FileBlob` API. - file = Linguist::FileBlob.new("lib/linguist.rb") - file.language.name #=> "Ruby" + Linguist::FileBlob.new("lib/linguist.rb").language.name #=> "Ruby" - file = Linguist::FileBlob.new("bin/linguist") - file.language.name #=> "Ruby" + Linguist::FileBlob.new("bin/linguist").language.name #=> "Ruby" See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/lib/linguist/language.rb) and [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). @@ -34,8 +32,7 @@ MIME types are used to set the Content-Type of raw binary blobs which are served The MIME type also determines whether a blob is binary or plain text. So if you're seeing a blob that says "View Raw" and it is actually plain text, the mime type and encoding probably needs to be explicitly stated. - file = Linguist::FileBlob.new("linguist.zip") - file.binary? #=> true + Linguist::FileBlob.new("linguist.zip").binary? #=> true See [lib/linguist/mimes.yml](https://github.com/github/linguist/blob/master/lib/linguist/mimes.yml). @@ -59,8 +56,7 @@ These stats are also printed out by the binary. Try running `linguist` on itself Checking other code into your git repo is a common practice. But this often inflates your project's language stats and may even cause your project to be labeled as another language. We are able to identify some of these files and directories and exclude them. - file = Linguist::FileBlob.new("vendor/plugins/foo.rb") - file.vendored? # => true + Linguist::FileBlob.new("vendor/plugins/foo.rb").vendored? # => true See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb) and [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml). @@ -68,8 +64,7 @@ See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/mas Not all plain text files are true source files. Generated files like minified js and compiled CoffeeScript can be detected and excluded from language stats. As an extra bonus, these files are suppressed in Diffs. - file = Linguist::FileBlob.new("underscore.min.js") - file.generated? # => true + Linguist::FileBlob.new("underscore.min.js").generated? # => true See [Linguist::BlobHelper#generated?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb).