Class: Allure::ContentType

Inherits:
Object
  • Object
show all
Defined in:
allure-ruby-commons/lib/allure_ruby_commons/model/content_type.rb

Overview

Commonly used mime type definitions

Constant Summary collapse

TXT =
"text/plain"
XML =
"application/xml"
CSV =
"text/csv"
TSV =
"text/tab-separated-values"
CSS =
"text/css"
URI =
"text/uri-list"
SVG =
"image/svg+xml"
PNG =
"image/png"
JSON =
"application/json"
WEBM =
"video/webm"
JPG =
"image/jpeg"

Class Method Summary collapse

Class Method Details

.to_extension(content_type) ⇒ String

Get file extension from mime type

Parameters:

  • content_type (String)

    mime type

Returns:

  • (String)

    file extension


23
24
25
# File 'allure-ruby-commons/lib/allure_ruby_commons/model/content_type.rb', line 23

def self.to_extension(content_type)
  MIME::Types[content_type]&.first&.preferred_extension
end