Sha256: 886f5fd4c3f1d27584ff8afbd4c1fd39942cbad44a853e93ebc3fd8371eb0965

Contents?: true

Size: 518 Bytes

Versions: 23

Compression:

Stored size: 518 Bytes

Contents

module Webrat #:nodoc:
  module MIME #:nodoc:
    MIME_TYPES = Rack::Mime::MIME_TYPES.dup.merge(
      ".multipart_form"   => "multipart/form-data",
      ".url_encoded_form" => "application/x-www-form-urlencoded"
    ).freeze

    def mime_type(type)
      return type if type.nil? || type.to_s.include?("/")
      type = ".#{type}" unless type.to_s[0] == ?.
      MIME_TYPES.fetch(type) { |type|
        raise ArgumentError.new("Invalid Mime type: #{type}")
      }
    end

    module_function :mime_type
  end
end

Version data entries

23 entries across 23 versions & 13 rubygems

Version Path
diabolo-webrat-0.5.1 lib/webrat/core/mime.rb
dstrelau-webrat-0.5.1 lib/webrat/core/mime.rb
hardbap-webrat-0.5.1 lib/webrat/core/mime.rb
hardbap-webrat-0.5.2 lib/webrat/core/mime.rb
revo-webrat-0.7.0.1 lib/webrat/core/mime.rb
davidtrogers-webrat-0.7.0 lib/webrat/core/mime.rb
revo-webrat-0.7.0 lib/webrat/core/mime.rb
revo-webrat-0.7.1.pre lib/webrat/core/mime.rb
webrat-0.7.0 lib/webrat/core/mime.rb
honkster-webrat-0.6.0.10 lib/webrat/core/mime.rb
honkster-webrat-0.6.0.9 lib/webrat/core/mime.rb
darkofabijan-webrat-0.6.1 lib/webrat/core/mime.rb
kbaum-webrat-0.5.1 lib/webrat/core/mime.rb
kbaum-webrat-0.6.1.pre lib/webrat/core/mime.rb
cynergy-webrat-0.6.0 lib/webrat/core/mime.rb
webrat-0.6.0 lib/webrat/core/mime.rb
radar-webrat-0.5.1.1 lib/webrat/core/mime.rb
radar-webrat-0.5.1 lib/webrat/core/mime.rb
mkuklis-webrat-0.5.1 lib/webrat/core/mime.rb
emipair-webrat-0.5.3 lib/webrat/core/mime.rb