Sha256: cdd8a8d0ea6bcfd7aa24a4be784207028ebe25122117dec1d2bb28db6c11799e

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module Webrat
  module MIME
    
    def self.mime_type(string_or_symbol)
      if string_or_symbol.is_a?(String)
        string_or_symbol
      else
        case string_or_symbol
        when :text              then "text/plain"
        when :html              then "text/html"
        when :js                then "text/javascript"
        when :css               then "text/css"
        when :ics               then "text/calendar"
        when :csv               then "text/csv"
        when :xml               then "application/xml"
        when :rss               then "application/rss+xml"
        when :atom              then "application/atom+xml"
        when :yaml              then "application/x-yaml"
        when :multipart_form    then "multipart/form-data"
        when :url_encoded_form  then "application/x-www-form-urlencoded"
        when :json              then "application/json"
        else
          raise ArgumentError.new("Invalid Mime type: #{string_or_symbol.inspect}")
        end
      end
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webrat-0.3.0 lib/webrat/core/mime.rb
webrat-0.3.2 lib/webrat/core/mime.rb
webrat-0.3.4 lib/webrat/core/mime.rb
webrat-0.3.3 lib/webrat/core/mime.rb
webrat-0.3.1 lib/webrat/core/mime.rb