ok
Direktori : /opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/ri/Rack/Static/ |
Current File : //opt/cpanel/ea-ruby27/root/usr/share/gems/doc/rack-2.2.8/ri/Rack/Static/cdesc-Static.ri |
U:RDoc::NormalClass[iI"Static:ETI"Rack::Static;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"FThe Rack::Static middleware intercepts requests for static files ;TI"O(javascript files, images, stylesheets, etc) based on the url prefixes or ;TI"Oroute mappings passed in the options, and serves them using a Rack::Files ;TI"Oobject. This allows a Rack stack to serve both static and dynamic content.;To:RDoc::Markup::BlankLine o; ;[I"Examples:;T@o; ;[I"NServe all requests beginning with /media from the "media" folder located ;TI"+in the current directory (ie media/*):;T@o:RDoc::Markup::Verbatim;[I"+use Rack::Static, :urls => ["/media"] ;T:@format0o; ;[I"LSame as previous, but instead of returning 404 for missing files under ;TI"&/media, call the next middleware:;T@o;;[I"=use Rack::Static, :urls => ["/media"], :cascade => true ;T;0o; ;[I"PServe all requests beginning with /css or /images from the folder "public" ;TI"Din the current directory (ie public/css/* and public/images/*):;T@o;;[I"Guse Rack::Static, :urls => ["/css", "/images"], :root => "public" ;T;0o; ;[I"OServe all requests to / with "index.html" from the folder "public" in the ;TI".current directory (ie public/index.html):;T@o;;[I"Iuse Rack::Static, :urls => {"/" => 'index.html'}, :root => 'public' ;T;0o; ;[I"IServe all requests normally from the folder "public" in the current ;TI";directory but uses index.html as default route for "/";T@o;;[I"Cuse Rack::Static, :urls => [""], :root => 'public', :index => ;TI"'index.html' ;T;0o; ;[I"0Set custom HTTP Headers for based on rules:;T@o;;[4I"- use Rack::Static, :root => 'public', ;TI" :header_rules => [ ;TI"J [rule, {header_field => content, header_field => content}], ;TI"0 [rule, {header_field => content}] ;TI" ] ;TI" ;TI" Rules for selecting files: ;TI" ;TI"1) All files ;TI" Provide the :all symbol ;TI"# :all => Matches every file ;TI" ;TI"2) Folders ;TI", Provide the folder path as a string ;TI"N '/folder' or '/folder/subfolder' => Matches files in a certain folder ;TI" ;TI"3) File Extensions ;TI"0 Provide the file extensions as an array ;TI"K ['css', 'js'] or %w(css js) => Matches files ending in .css or .js ;TI" ;TI"%4) Regular Expressions / Regexp ;TI"% Provide a regular expression ;TI"B %r{\.(?:css|js)\z} => Matches files ending in .css or .js ;TI"H /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ => Matches files ending in ;TI"S the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg) ;TI"N Note: This Regexp is available as a shortcut, using the :fonts rule ;TI" ;TI"5) Font Shortcut ;TI"" Provide the :fonts symbol ;TI"_ :fonts => Uses the Regexp rule stated right above to match all common web font endings ;TI" ;TI"Rule Ordering: ;TI"> Rules are applied in the order that they are provided. ;TI"5 List rather general rules above special ones. ;TI" ;TI"<Complete example use case including HTTP header rules: ;TI" ;TI"- use Rack::Static, :root => 'public', ;TI" :header_rules => [ ;TI"K # Cache all static files in public caches (e.g. Rack::Cache) ;TI"+ # as well as in the browser ;TI"G [:all, {'Cache-Control' => 'public, max-age=31536000'}], ;TI" ;TI"K # Provide web fonts with cross-origin access-control-headers ;TI"\ # Firefox requires this when serving assets using a Content Delivery Network ;TI"? [:fonts, {'Access-Control-Allow-Origin' => '*'}] ;TI" ];T;0: @fileI"lib/rack/static.rb;T:0@omit_headings_from_table_of_contents_below0; 0;0[ [ [ [[I" class;T[[:public[[I"new;TI"lib/rack/static.rb;T[:protected[ [:private[ [I" instance;T[[;[[I"add_index_root?;T@|[I"applicable_rules;T@|[I" call;T@|[I"can_serve;T@|[I"overwrite_file_path;T@|[I"route_file;T@|[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@pI" Rack;TcRDoc::NormalModule