sass-site/source/documentation/Sass/Plugin/Rack.html
2018-10-22 14:13:05 -07:00

586 lines
16 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: Sass::Plugin::Rack
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../../';
framesUrl = "../../frames.html#!Sass/Plugin/Rack.html";
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (R)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span>
&raquo;
<span class="title">Rack</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: Sass::Plugin::Rack
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Sass::Plugin::Rack</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/plugin/rack.rb</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Rack middleware for compiling Sass code.</p>
<p>## Activate</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>sass/plugin/rack</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_use'>use</span> <span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span><span class='op'>::</span><span class='const'>Rack</span>
</code></pre>
<p>## Customize</p>
<pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span><span class='period'>.</span><span class='id identifier rubyid_options'><span class='object_link'><a href="../Plugin.html#options-instance_method" title="Sass::Plugin#options (method)">options</a></span></span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span>
<span class='symbol'>:cache_location</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>./tmp/sass-cache</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
<span class='symbol'>:never_update</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_environment'>environment</span> <span class='op'>!=</span> <span class='symbol'>:production</span><span class='comma'>,</span>
<span class='symbol'>:full_exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_environment'>environment</span> <span class='op'>!=</span> <span class='symbol'>:production</span><span class='rparen'>)</span>
</code></pre>
<p><a href="../../file.SASS_REFERENCE.html#Options" title="See the Reference for more options">See the Reference for more options</a>.</p>
<p>## Use</p>
<p>Put your Sass files in `public/stylesheets/sass`. Your CSS will be
generated in `public/stylesheets`, and regenerated every request if
necessary. The locations and frequency <a href="../../file.SASS_REFERENCE.html#Options" title="can be customized">can be customized</a>. That&#39;s all there is to it!</p>
</div>
</div>
<div class="tags">
</div>
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#dwell-instance_method" title="#dwell (instance method)">#<strong>dwell</strong> &#x21d2; Float </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>The delay, in seconds, between update checks.</p>
</div></span>
</li>
</ul>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(env) &#x21d2; (#to_i, {String =&gt; String}, Object) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Process a request, checking the Sass stylesheets for changes and updating
them if necessary.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(app, dwell = 1.0) &#x21d2; Rack </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Initialize the middleware.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(app, dwell = 1.0) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Plugin::Rack (class)">Rack</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initialize the middleware.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>app</span>
<span class='type'>(<tt>#<span class='object_link'><a href="#call-instance_method" title="Sass::Plugin::Rack#call (method)">call</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The Rack application</p>
</div>
</li>
<li>
<span class='name'>dwell</span>
<span class='type'>(<tt>Float</tt>)</span>
<em class="default">(defaults to: <tt>1.0</tt>)</em>
&mdash;
<div class='inline'>
<p>See <span class='object_link'><a href="#dwell-instance_method" title="Sass::Plugin::Rack#dwell (method)">#dwell</a></span></p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
38
39
40
41
42</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/rack.rb', line 38</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_dwell'>dwell</span> <span class='op'>=</span> <span class='float'>1.0</span><span class='rparen'>)</span>
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
<span class='ivar'>@dwell</span> <span class='op'>=</span> <span class='id identifier rubyid_dwell'>dwell</span>
<span class='ivar'>@check_after</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(app, dwell = 1.0) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Plugin::Rack (class)">Rack</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initialize the middleware.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>app</span>
<span class='type'>(<tt>#<span class='object_link'><a href="#call-instance_method" title="Sass::Plugin::Rack#call (method)">call</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The Rack application</p>
</div>
</li>
<li>
<span class='name'>dwell</span>
<span class='type'>(<tt>Float</tt>)</span>
<em class="default">(defaults to: <tt>1.0</tt>)</em>
&mdash;
<div class='inline'>
<p>See <span class='object_link'><a href="#dwell-instance_method" title="Sass::Plugin::Rack#dwell (method)">#dwell</a></span></p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
38
39
40
41
42</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/rack.rb', line 38</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_dwell'>dwell</span> <span class='op'>=</span> <span class='float'>1.0</span><span class='rparen'>)</span>
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
<span class='ivar'>@dwell</span> <span class='op'>=</span> <span class='id identifier rubyid_dwell'>dwell</span>
<span class='ivar'>@check_after</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id="dwell=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="dwell-instance_method">
#<strong>dwell</strong> &#x21d2; <tt>Float</tt>
</h3><div class="docstring">
<div class="discussion">
<p>The delay, in seconds, between update checks. Useful when many resources
are requested for a single page. `nil` means no delay at all.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Float</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
32
33
34</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/rack.rb', line 32</span>
<span class='kw'>def</span> <span class='id identifier rubyid_dwell'>dwell</span>
<span class='ivar'>@dwell</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="call-instance_method">
#<strong>call</strong>(env) &#x21d2; <tt>(#to_i, {String =&gt; String}, Object)</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Process a request, checking the Sass stylesheets for changes and updating
them if necessary.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>env</span>
<span class='type'></span>
&mdash;
<div class='inline'>
<p>The Rack request environment</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>(#to_i, {String =&gt; String}, Object)</tt>)</span>
&mdash;
<div class='inline'>
<p>The Rack response</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
49
50
51
52
53
54
55</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/plugin/rack.rb', line 49</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='ivar'>@dwell</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>&gt;</span> <span class='ivar'>@check_after</span>
<span class='const'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Plugin.html" title="Sass::Plugin (module)">Plugin</a></span></span><span class='period'>.</span><span class='id identifier rubyid_check_for_updates'><span class='object_link'><a href="../Plugin.html#check_for_updates-instance_method" title="Sass::Plugin#check_for_updates (method)">check_for_updates</a></span></span>
<span class='ivar'>@check_after</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>+</span> <span class='ivar'>@dwell</span> <span class='kw'>if</span> <span class='ivar'>@dwell</span>
<span class='kw'>end</span>
<span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:20:52 2018 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.12 (ruby-2.5.3).
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-535380-14', 'sass-lang.com');
ga('send', 'pageview');
</script>
</body>
</html>