Extractor is a simple Ruby binding for libextractor. It allows you to read metadata from a wide number of file types. You may install it by typing

  gem install extractor

or by downloading it manually here.

To use extractor try something like this:

  require 'extractor'
  metadata = Extractor.extract('happy.mp3')
  puts metadata['mimetype']
  puts metadata['artist']

Sometimes there will be more than one entry for a metadata type. For example, an mp3 may have two artists. If this is the case then you might have

  metadata['artist'] == ['Puff Daddy', 'The Family']