Class: Assets::Mime
Overview
Mime type for assets
Constant Summary collapse
- REGISTRY =
{}
- JPG =
new('.jpg', 'image/jpg' )
- ICO =
new('.ico', 'image/vnd.microsoft.icon' )
- PNG =
new('.png', 'image/png' )
- GIF =
new('.gif', 'image/gif' )
- SVG =
new('.svg', 'image/svg' )
- PDF =
new('.pdf', 'application/pdf' )
- RUBY =
new('.rb', 'application/ruby' )
- TXT =
new('.txt', 'text/plain; charset=UTF-8' )
- CSS =
new('.css', 'text/css; charset=UTF-8' )
- JAVASCRIPT =
new('.js', 'application/javascript; charset=UTF-8' )
- COFFEESCRIPT =
new('.coffee', 'application/coffeescript; charset=UTF-8' )
- SASS =
new('.sass', 'text/plain; charset=UTF-8' )
- SCSS =
new('.scss', 'text/plain; charset=UTF-8' )
- HTML =
new('.html', 'text/html; charset=UTF-8' )
- WOFF =
new('.woff', 'application/font-woff' )
- EOT =
new('.eot', 'application/vnd.ms-fontobject' )
- IMAGES =
[ JPG, ICO, PNG, SVG, GIF ].freeze
Instance Attribute Summary collapse
-
#content_type ⇒ String
readonly
private
Return content type.
-
#extname ⇒ String
readonly
private
Return extname.
Class Method Summary collapse
-
.extname(extname) ⇒ Mime
private
Return mime for extname.
-
.from_name(name) ⇒ Mime
private
Return mime name.
Instance Attribute Details
#content_type ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return content type
22 23 24 |
# File 'lib/assets/mime.rb', line 22 def content_type @content_type end |
#extname ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return extname
14 15 16 |
# File 'lib/assets/mime.rb', line 14 def extname @extname end |
Class Method Details
.extname(extname) ⇒ Mime
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mime for extname
32 33 34 |
# File 'lib/assets/mime.rb', line 32 def self.extname(extname) REGISTRY.fetch(extname) end |
.from_name(name) ⇒ Mime
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mime name
44 45 46 |
# File 'lib/assets/mime.rb', line 44 def self.from_name(name) extname(::File.extname(name)) end |