Sha256: 792c25bca083a50bef2fca5c419b97b8697d4dd8b7c45b44b53de994abe6655f

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

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

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

5 entries across 5 versions & 3 rubygems

Version Path
clivecrous-ramaze-0.3.9.5 lib/ramaze/tool/mime.rb
manveru-ramaze-2008.07 lib/ramaze/tool/mime.rb
ramaze-0.3.9 lib/ramaze/tool/mime.rb
ramaze-0.3.9.1 lib/ramaze/tool/mime.rb
ramaze-2008.06 lib/ramaze/tool/mime.rb