best_type

A pure-ruby library for selecting the best MIME type for a file name, or DC type for a file name / MIME type.

Installation

gem install best_type

Standalone Usage

require 'best_type'

TODO: Provide usage examples

Rails Usage

Gemfile:

gem 'best_type'

Adding Custom Overrides via initializer (config/initializers/best_type.rb):

# via hash
BestType.configure({
  extension_to_mime_type_overrides:
    'ext': 'mime/type'
  mime_type_to_dc_type_overrides:
    'mime/type': 'GreatType'
})

# via YAML file, based on Rails environment:
BestType.configure(YAML.load_file('config/best_type.yml')[Rails.env])

Running Tests (for developers):

Tests are great and we should run them. Here's how:

bundle exec rake best_type:ci

Building the Gem and Pushing to RubyGems (for developers):

bundle exec rake release