Sha256: 0f180f368cb8173557277fe6be71a035390fbab61c72773acd8a258eaea6ee5e

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

# FileClassify

Binary and ASCII classification for files

[![Gem Version](https://badge.fury.io/rb/file_classify.png)](http://badge.fury.io/rb/file_classify)
[![Build Status](https://travis-ci.org/rcaught/file_classify.png?branch=master)](https://travis-ci.org/rcaught/file_classify)
[![Dependency Status](https://gemnasium.com/rcaught/file_classify.png)](https://gemnasium.com/rcaught/file_classify)
[![Coverage Status](https://coveralls.io/repos/rcaught/file_classify/badge.png)](https://coveralls.io/r/rcaught/file_classify)
[![Code Climate](https://codeclimate.com/github/rcaught/file_classify.png)](https://codeclimate.com/github/rcaught/file_classify)

## Installation

Add this line to your application's Gemfile:

    gem 'file_classify'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install file_classify

## Usage

```ruby
require 'file_classify'

classifier = FileClassify.new(path: 'spec/resources/binary.jpg')
 => #<FileClassify:0x007fbf04c31098 @contents=nil, @path="spec/resources/binary.jpg">
classifier.binary?
 => true
classifier.ascii?
 => false
classifier.classify
 => "binary"
 

# Or perhaps you have file contents?

classifier = FileClassify.new(contents: 'And miles to go before I sleep.')
 => #<FileClassify:0x007fbf04cd0ff8 @contents="And miles to go before I sleep.", @path=nil>
classifier.binary?
 => false
classifier.ascii?
 => true
classifier.classify
 => "ascii"
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
file_classify-0.0.2 README.md