Class: Assets::Mime
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' )
- 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
21 22 23 |
# File 'lib/assets/mime.rb', line 21 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
13 14 15 |
# File 'lib/assets/mime.rb', line 13 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
31 32 33 |
# File 'lib/assets/mime.rb', line 31 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
43 44 45 |
# File 'lib/assets/mime.rb', line 43 def self.from_name(name) extname(::File.extname(name)) end |