Sha256: 413316c2bd899b28dd925ad234cbd8137f585db7388181bd5cdb7a143ae32c9a

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'yaml'

module Ramaze
  module Tool

    # Responsible for lookup of MIME info for filetypes based on extension.

    module MIME

      # the mime_types.yaml as full path, we use a copy of mongrels.
      trait :types => YAML.load_file(BASEDIR/'ramaze'/'tool'/'mime_types.yaml')

      class << self

        # Get MIME-type for the given filename based on extension.
        # Answers with an empty string if none is found.
        def type_for file
          ext = File.extname(file)
          trait[:types][ext].to_s
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 lib/ramaze/tool/mime.rb
ramaze-0.2.0 lib/ramaze/tool/mime.rb
ramaze-0.2.1 lib/ramaze/tool/mime.rb