Sha256: 412d28a440a6e5c88af2a6a03025dc3fae7699cbe844dd4b8d761c411c2a4274
Contents?: true
Size: 649 Bytes
Versions: 57
Compression:
Stored size: 649 Bytes
Contents
# frozen_string_literal: true require "webrick" module ShopifyCLI module Theme class MimeType < Struct.new(:name) MIME_TYPES = WEBrick::HTTPUtils::DefaultMimeTypes.merge( "liquid" => "text/x-liquid", ) class << self def by_filename(filename) new(WEBrick::HTTPUtils.mime_type(filename.to_s, MIME_TYPES)) end end def text? /text/.match?(name) || json? || javascript? end def json? name == "application/json" end def javascript? name == "application/javascript" end def to_s name end end end end
Version data entries
57 entries across 57 versions & 1 rubygems