Method: RDoc::Servlet#asset
- Defined in:
- lib/rdoc/servlet.rb
#asset(generator_name, req, res) ⇒ Object
Serves the asset at the path in req for generator_name via res.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/rdoc/servlet.rb', line 100 def asset generator_name, req, res asset_dir = @asset_dirs[generator_name] asset_path = File.join asset_dir, req.path if_modified_since req, res, asset_path res.body = File.read asset_path res.content_type = case req.path when /\.css\z/ then 'text/css' when /\.js\z/ then 'application/javascript' else 'application/octet-stream' end end |