Class: ShopifyCLI::Theme::MimeType
- Inherits:
-
Struct
- Object
- Struct
- ShopifyCLI::Theme::MimeType
- Defined in:
- lib/shopify_cli/theme/mime_type.rb
Constant Summary collapse
- MIME_TYPES =
WEBrick::HTTPUtils::DefaultMimeTypes.merge( "liquid" => "text/x-liquid", )
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 6 def name @name end |
Class Method Details
.by_filename(filename) ⇒ Object
12 13 14 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 12 def by_filename(filename) new(WEBrick::HTTPUtils.mime_type(filename.to_s, MIME_TYPES)) end |
Instance Method Details
#javascript? ⇒ Boolean
25 26 27 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 25 def javascript? name == "application/javascript" end |
#json? ⇒ Boolean
21 22 23 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 21 def json? name == "application/json" end |
#text? ⇒ Boolean
17 18 19 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 17 def text? /text/.match?(name) || json? || javascript? end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/shopify_cli/theme/mime_type.rb', line 29 def to_s name end |