doc/classes/AssetHat.html in asset_hat-0.3.1 vs doc/classes/AssetHat.html in asset_hat-0.4.0
- old
+ new
@@ -32,14 +32,17 @@
<ol class='paths'>
<li>
<a href="../files/lib/asset_hat/css_rb.html">lib/asset_hat/css.rb</a>
</li>
<li class='other'>
+ <a href="../files/lib/asset_hat/js_rb.html">lib/asset_hat/js.rb</a>
+ </li>
+ <li class='other'>
<a href="../files/lib/asset_hat/js/vendors_rb.html">lib/asset_hat/js/vendors.rb</a>
</li>
<li class='other'>
- <a href="../files/lib/asset_hat/js_rb.html">lib/asset_hat/js.rb</a>
+ <a href="../files/lib/asset_hat/railtie_rb.html">lib/asset_hat/railtie.rb</a>
</li>
<li class='other'>
<a href="../files/lib/asset_hat/vcs_rb.html">lib/asset_hat/vcs.rb</a>
</li>
<li class='other'>
@@ -55,71 +58,36 @@
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<p>
- Your assets are covered.
+ Your assets are covered. See <a
+ href="../files/README_rdoc.html">README.rdoc</a> for more.
</p>
- <p>
- With Rails’ default asset caching, <a
- href="AssetHat/CSS.html">CSS</a> and <a href="AssetHat/JS.html">JS</a> are
- concatenated (not even minified) at runtime when that bundle is first
- requested. Not good enough. <a href="AssetHat.html">AssetHat</a> can
- automatically:
- </p>
- <ul>
- <li>Easily <b>minify</b> and <b>bundle</b> <a href="AssetHat/CSS.html">CSS</a>
- and <a href="AssetHat/JS.html">JS</a> on deploy to reduce file sizes and
- HTTP requests.
-
- </li>
- <li>Load popular <strong>third-party JS</strong> (like jQuery and Prototype)
- from <a href="http://code.google.com/apis/ajaxlibs/"><strong>Google's
- CDN</strong></a> when in production, or from localhost in development.
-
- </li>
- <li>Force image URLs in your <a href="AssetHat/CSS.html">CSS</a> to use
- <strong>CDN subdomains</strong>, not just the current host.
-
- </li>
- <li>Add an image’s last <a href="http://git-scm.com/">Git</a> commit ID
- to its <a href="AssetHat/CSS.html">CSS</a> URLs to <strong>bust browser
- caches</strong> (e.g., <tt>/images/foo.png?ab12cd3</tt>).
-
- </li>
- </ul>
- <p>
- After setup, you can use these in your layouts and views:
- </p>
- <pre><%= include_css :bundle => 'application' %>
 # => <link href="/stylesheets/bundles/application.min.css"
 # media="screen,projection" rel="stylesheet" type="text/css" />

<%= include_js :bundles => ['plugins', 'common'] %>
 # => <script src="/javascripts/bundles/plugins.min.js"
 # type="text/javascript"></script>
 # <script src="/javascripts/bundles/common.min.js"
 # type="text/javascript"></script></pre>
- <p>
- And this in your deploy script:
- </p>
- <pre>rake asset_hat:minify</pre>
- <p>
- See <a href="../files/README_rdoc.html">README.rdoc</a> for more.
- </p>
</div>
<div id='method-list'>
<h2>Methods</h2>
<h3>public class</h3>
<ol>
- <li><a href="#M000008">asset_exists?</a></li>
+ <li><a href="#M000010">asset_exists?</a></li>
<li><a href="#M000006">assets_dir</a></li>
- <li><a href="#M000011">bundle_filenames</a></li>
- <li><a href="#M000012">bundle_filepaths</a></li>
- <li><a href="#M000007">bundles_dir</a></li>
- <li><a href="#M000009">cache?</a></li>
- <li><a href="#M000003">cache_last_commit_ids</a></li>
- <li><a href="#M000015">clear_html_cache</a></li>
- <li><a href="#M000013">compute_asset_host</a></li>
+ <li><a href="#M000007">assets_path</a></li>
+ <li><a href="#M000014">bundle_filenames</a></li>
+ <li><a href="#M000015">bundle_filepaths</a></li>
+ <li><a href="#M000008">bundles_dir</a></li>
+ <li><a href="#M000009">bundles_path</a></li>
+ <li><a href="#M000011">cache?</a></li>
+ <li><a href="#M000004">cache_last_commit_ids</a></li>
+ <li><a href="#M000018">clear_html_cache</a></li>
+ <li><a href="#M000016">compute_asset_host</a></li>
<li><a href="#M000005">config</a></li>
- <li><a href="#M000002">last_bundle_commit_id</a></li>
- <li><a href="#M000001">last_commit_id</a></li>
- <li><a href="#M000010">min_filepath</a></li>
- <li><a href="#M000014">ssl_asset_host_differs?</a></li>
- <li><a href="#M000004">version</a></li>
+ <li><a href="#M000012">consider_all_requests_local?</a></li>
+ <li><a href="#M000003">last_bundle_commit_id</a></li>
+ <li><a href="#M000002">last_commit_id</a></li>
+ <li><a href="#M000013">min_filepath</a></li>
+ <li><a href="#M000017">ssl_asset_host_differs?</a></li>
+ <li><a href="#M000001">version</a></li>
</ol>
</div>
<div id='section'>
<div id='class-list'>
<h2>Classes and Modules</h2>
@@ -151,37 +119,57 @@
</td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>ASSETS_DIR</td>
<td>=</td>
- <td class='context-item-value'>defined?(Rails.public_path) ? Rails.public_path : 'public'</td>
+ <td class='context-item-value'>defined?(Rails.public_path) && Rails.public_path.present? ? Rails.public_path : 'public'</td>
<td> </td>
<td class='context-item-desc'>
Base directory in which all assets are kept, e.g., ‘public/’.
</td>
</tr>
<tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>STYLESHEETS_PATH</td>
+ <td>=</td>
+ <td class='context-item-value'>'/stylesheets'</td>
+ <td> </td>
+ <td class='context-item-desc'>
+
+ Root URL path for all stylesheets. For public-facing use.
+ </td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>JAVASCRIPTS_PATH</td>
+ <td>=</td>
+ <td class='context-item-value'>'/javascripts'</td>
+ <td> </td>
+ <td class='context-item-desc'>
+
+ Root URL path for all JavaScripts. For public-facing use.
+ </td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
<td class='context-item-name'>STYLESHEETS_DIR</td>
<td>=</td>
<td class='context-item-value'>File.join(ASSETS_DIR, 'stylesheets')</td>
<td> </td>
<td class='context-item-desc'>
Directory in which all stylesheets are kept, e.g.,
- ‘public/stylesheets/’.
+ ‘public/stylesheets’. For internal filesystem use.
</td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>JAVASCRIPTS_DIR</td>
<td>=</td>
<td class='context-item-value'>File.join(ASSETS_DIR, 'javascripts')</td>
<td> </td>
<td class='context-item-desc'>
Directory in which all JavaScripts are kept, e.g.,
- ‘public/javascripts/’.
+ ‘public/javascripts’. For internal filesystem use.
</td>
</tr>
<tr class='top-aligned-row context-row'>
<td class='context-item-name'>RELATIVE_CONFIG_FILEPATH</td>
<td>=</td>
@@ -205,12 +193,12 @@
</table>
</div>
</div>
<div id='methods'>
<h2>Public class methods</h2>
- <div class='method public-class' id='method-M000008'>
- <a name='M000008'></a>
+ <div class='method public-class' id='method-M000010'>
+ <a name='M000010'></a>
<div class='synopsis'>
<span class='name'>asset_exists?</span>
<span class='arguments'>(filename, type)</span>
</div>
<div class='description'>
@@ -221,14 +209,14 @@
<p>
See also <tt><a href="AssetHat.html#M000006">AssetHat.assets_dir</a></tt>.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
[show source]
</a>
- <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 127</span>
127: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">asset_exists?</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">type</span>)
128: <span class="ruby-comment cmt"># Process arguments</span>
129: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
130: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
131: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
132: <span class="ruby-keyword kw">return</span>
133: <span class="ruby-keyword kw">end</span>
134: 
135: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
136: <span class="ruby-ivar">@asset_exists</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
137: 
138: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>].<span class="ruby-identifier">nil?</span>
139: <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>] =
140: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-identifier">filename</span>))
141: <span class="ruby-keyword kw">end</span>
142: <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>]
143: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 154</span>
154: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">asset_exists?</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">type</span>)
155: <span class="ruby-comment cmt"># Process arguments</span>
156: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
157: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
158: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
159: <span class="ruby-keyword kw">return</span>
160: <span class="ruby-keyword kw">end</span>
161: 
162: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
163: <span class="ruby-ivar">@asset_exists</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
164: 
165: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>].<span class="ruby-identifier">nil?</span>
166: <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>] =
167: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-identifier">filename</span>))
168: <span class="ruby-keyword kw">end</span>
169: <span class="ruby-ivar">@asset_exists</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">filename</span>]
170: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-class' id='method-M000006'>
<a name='M000006'></a>
<div class='synopsis'>
@@ -237,72 +225,95 @@
</div>
<div class='description'>
<p>
Returns the relative path to the directory where the original <a
href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a> files
- are stored.
+ are stored. For internal filesystem use.
</p>
<p>
<tt>type</tt> argument: <tt>:css</tt> or <tt>:js</tt>
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
[show source]
</a>
- <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 76</span>
76: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
77: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
78: 
79: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
80: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
81: <span class="ruby-keyword kw">return</span>
82: <span class="ruby-keyword kw">end</span>
83: 
84: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
85: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_DIR</span>
86: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-constant">JAVASCRIPTS_DIR</span>
87: <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">nil</span>
88: <span class="ruby-keyword kw">end</span>
89: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 63</span>
63: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
64: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
65: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_DIR</span>
66: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-constant">JAVASCRIPTS_DIR</span>
67: <span class="ruby-keyword kw">else</span>
68: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
69: <span class="ruby-keyword kw">nil</span>
70: <span class="ruby-keyword kw">end</span>
71: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000011'>
- <a name='M000011'></a>
+ <div class='method public-class' id='method-M000007'>
+ <a name='M000007'></a>
<div class='synopsis'>
+ <span class='name'>assets_path</span>
+ <span class='arguments'>(type)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Returns the root URL path where the original <a
+ href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a> files
+ are stored. For external URL-building use.
+ </p>
+ <p>
+ <tt>type</tt> argument: <tt>:css</tt> or <tt>:js</tt>
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 77</span>
77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_path</span>(<span class="ruby-identifier">type</span>)
78: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
79: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_PATH</span>
80: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-constant">JAVASCRIPTS_PATH</span>
81: <span class="ruby-keyword kw">else</span>
82: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
83: <span class="ruby-keyword kw">nil</span>
84: <span class="ruby-keyword kw">end</span>
85: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000014'>
+ <a name='M000014'></a>
+ <div class='synopsis'>
<span class='name'>bundle_filenames</span>
<span class='arguments'>(bundle, type)</span>
</div>
<div class='description'>
<p>
Returns the extension-less names of files in the given bundle:
</p>
- <pre>AssetHat.bundle_filenames('application', :css)
 # => ['reset', 'application', 'clearfix']
AssetHat.bundle_filenames('non-existent-file', :css)
 # => nil</pre>
+ <pre>AssetHat.bundle_filenames('application', :css)
 # => ['reset', 'application']
AssetHat.bundle_filenames('non-existent-file', :css)
 # => nil</pre>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
[show source]
</a>
- <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 169</span>
169: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
170: <span class="ruby-comment cmt"># Process arguments</span>
171: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
172: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
173: <span class="ruby-keyword kw">return</span>
174: <span class="ruby-keyword kw">end</span>
175: 
176: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>][<span class="ruby-identifier">bundle</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
177: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 210</span>
210: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
211: <span class="ruby-comment cmt"># Process arguments</span>
212: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
213: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
214: <span class="ruby-keyword kw">return</span>
215: <span class="ruby-keyword kw">end</span>
216: 
217: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>][<span class="ruby-identifier">bundle</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
218: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000012'>
- <a name='M000012'></a>
+ <div class='method public-class' id='method-M000015'>
+ <a name='M000015'></a>
<div class='synopsis'>
<span class='name'>bundle_filepaths</span>
<span class='arguments'>(bundle, type)</span>
</div>
<div class='description'>
<p>
Returns the full paths of files in the given bundle:
</p>
- <pre>AssetHat.bundle_filenames('application', :css)
 # => ['/path/to/app/public/stylesheets/reset.css',
 '/path/to/app/public/stylesheets/application.css',
 '/path/to/app/public/stylesheets/clearfix.css']
AssetHat.bundle_filenames('non-existent-file', :css)
 # => nil</pre>
+ <pre>AssetHat.bundle_filenames('application', :css)
 # => ['/path/to/app/public/stylesheets/reset.css',
 '/path/to/app/public/stylesheets/application.css']
AssetHat.bundle_filenames('non-existent-file', :css)
 # => nil</pre>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
[show source]
</a>
- <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 187</span>
187: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
188: <span class="ruby-comment cmt"># Process arguments</span>
189: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
190: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
191: <span class="ruby-keyword kw">return</span>
192: <span class="ruby-keyword kw">end</span>
193: 
194: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
195: <span class="ruby-identifier">filenames</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
196: <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">?
197: </span> <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">fn</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-node">"#{fn}.#{type}"</span>) } <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
198: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 227</span>
227: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
228: <span class="ruby-comment cmt"># Process arguments</span>
229: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>)
230: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
231: <span class="ruby-keyword kw">return</span>
232: <span class="ruby-keyword kw">end</span>
233: 
234: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
235: <span class="ruby-identifier">filenames</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filenames</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
236: <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">?
237: </span> <span class="ruby-identifier">filenames</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">fn</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-node">"#{fn}.#{type}"</span>) } <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
238: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000007'>
- <a name='M000007'></a>
+ <div class='method public-class' id='method-M000008'>
+ <a name='M000008'></a>
<div class='synopsis'>
<span class='name'>bundles_dir</span>
<span class='arguments'>(*args)</span>
</div>
<div class='description'>
<p>
Returns the relative path to the directory where <a
href="AssetHat/CSS.html">CSS</a> or <a href="AssetHat/JS.html">JS</a>
- bundles are stored.
+ bundles are stored. For internal filesystem use.
</p>
<p>
Usage:
</p>
<pre>AssetHat.bundles_dir
 # => 'bundles'
AssetHat.bundles_dir(:ssl => true)
 # => 'bundles/ssl'
AssetHat.bundles_dir(:css)
 # => 'public/stylesheets/bundles'
AssetHat.bundles_dir(:js, :ssl => true)
 # => 'public/javascripts/bundles/ssl</pre>
@@ -315,40 +326,73 @@
</dd>
</dl>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
[show source]
</a>
- <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 109</span>
109: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundles_dir</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
110: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
111: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys!</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>)
112: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
113: 
114: <span class="ruby-identifier">dir</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">? </span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-value str">'bundles'</span>) <span class="ruby-operator">:</span> <span class="ruby-value str">'bundles'</span>
115: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-value str">'ssl'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>]
116: <span class="ruby-identifier">dir</span>
117: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 105</span>
105: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundles_dir</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
106: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
107: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys!</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>)
108: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
109: 
110: <span class="ruby-identifier">dir</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">present?</span> <span class="ruby-value">? </span><span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>), <span class="ruby-value str">'bundles'</span>) <span class="ruby-operator">:</span> <span class="ruby-value str">'bundles'</span>
111: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-value str">'ssl'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>]
112: <span class="ruby-identifier">dir</span>
113: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-class' id='method-M000009'>
<a name='M000009'></a>
<div class='synopsis'>
+ <span class='name'>bundles_path</span>
+ <span class='arguments'>(type, options={})</span>
+ </div>
+ <div class='description'>
+ <p>
+ Returns the root URL path where <a href="AssetHat/CSS.html">CSS</a> or <a
+ href="AssetHat/JS.html">JS</a> bundles are stored. For external
+ URL-building use.
+ </p>
+ <p>
+ Usage:
+ </p>
+ <pre>AssetHat.bundles_path(:css)
 # => 'public/stylesheets/bundles'
AssetHat.bundles_path(:js, :ssl => true)
 # => 'public/javascripts/bundles/ssl</pre>
+ <p>
+ Options:
+ </p>
+ <dl>
+ <dt>ssl</dt><dd>Set this to <tt>true</tt> if the stylesheet references images via SSL.
+ Defaults to <tt>false</tt>.
+
+ </dd>
+ </dl>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 129</span>
129: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundles_path</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span>={})
130: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
131: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
132: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
133: <span class="ruby-keyword kw">return</span>
134: <span class="ruby-keyword kw">end</span>
135: 
136: <span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
137: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-constant">STYLESHEETS_PATH</span>
138: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-constant">JAVASCRIPTS_PATH</span>
139: <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">nil</span>
140: <span class="ruby-keyword kw">end</span>
141: <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/bundles'</span>
142: <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/ssl'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>]
143: <span class="ruby-identifier">path</span>
144: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000011'>
+ <a name='M000011'></a>
+ <div class='synopsis'>
<span class='name'>cache?</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Returns <tt>true</tt> if bundles should be included as single minified
files (e.g., in production), or <tt>false</tt> if bundles should be
included as separate, unminified files (e.g., in development). To modify
- this value, set <tt>config.action_controller.perform_caching = true</tt> in
- your environment.
+ this value, set <tt>config.action_controller.perform_caching</tt> (boolean)
+ in your environment.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
[show source]
</a>
- <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 150</span>
150: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache?</span> ; <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">perform_caching</span> ; <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 178</span>
178: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache?</span> ; <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">perform_caching</span> ; <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000003'>
- <a name='M000003'></a>
+ <div class='method public-class' id='method-M000004'>
+ <a name='M000004'></a>
<div class='synopsis'>
<span class='name'>cache_last_commit_ids</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
@@ -356,40 +400,40 @@
Precomputes and caches the last commit ID for all bundles. Your web server
process(es) should run this at boot to avoid overhead during user runtime.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
[show source]
</a>
- <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 74</span>
74: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_last_commit_ids</span>
75: <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
76: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>].<span class="ruby-identifier">blank?</span> <span class="ruby-operator">||</span>
77: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>].<span class="ruby-identifier">blank?</span>
78: 
79: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bundle</span><span class="ruby-operator">|</span>
80: <span class="ruby-comment cmt"># Memoize commit ID for this bundle</span>
81: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">cache?</span>
82: 
83: <span class="ruby-comment cmt"># Memoize commit IDs for each file in this bundle</span>
84: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filepath</span><span class="ruby-operator">|</span>
85: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-identifier">filepath</span>)
86: <span class="ruby-keyword kw">end</span>
87: <span class="ruby-keyword kw">end</span>
88: <span class="ruby-keyword kw">end</span>
89: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 75</span>
75: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cache_last_commit_ids</span>
76: <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
77: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>].<span class="ruby-identifier">blank?</span> <span class="ruby-operator">||</span>
78: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>].<span class="ruby-identifier">blank?</span>
79: 
80: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>][<span class="ruby-value str">'bundles'</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bundle</span><span class="ruby-operator">|</span>
81: <span class="ruby-comment cmt"># Memoize commit ID for this bundle</span>
82: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">cache?</span>
83: 
84: <span class="ruby-comment cmt"># Memoize commit IDs for each file in this bundle</span>
85: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filepath</span><span class="ruby-operator">|</span>
86: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-identifier">filepath</span>)
87: <span class="ruby-keyword kw">end</span>
88: <span class="ruby-keyword kw">end</span>
89: <span class="ruby-keyword kw">end</span>
90: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000015'>
- <a name='M000015'></a>
+ <div class='method public-class' id='method-M000018'>
+ <a name='M000018'></a>
<div class='synopsis'>
<span class='name'>clear_html_cache</span>
<span class='arguments'>()</span>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
[show source]
</a>
- <pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 249</span>
249: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">clear_html_cache</span>
250: <span class="ruby-identifier">html_cache</span> = {}
251: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 294</span>
294: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">clear_html_cache</span>
295: <span class="ruby-identifier">html_cache</span> = {}
296: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000013'>
- <a name='M000013'></a>
+ <div class='method public-class' id='method-M000016'>
+ <a name='M000016'></a>
<div class='synopsis'>
<span class='name'>compute_asset_host</span>
<span class='arguments'>(asset_host, source, options={})</span>
</div>
<div class='description'>
<p>
Reads <tt>ActionController::Base.asset_host</tt>, which can be a String or
Proc, and returns a String. Should behave just like Rails 2.3.x’s
- private `<a href="AssetHat.html#M000013">compute_asset_host</a>` method,
+ private `<a href="AssetHat.html#M000016">compute_asset_host</a>` method,
but with a simulated request.
</p>
<p>
Example environment config for CDN support via SSL:
</p>
@@ -408,14 +452,14 @@
</dd>
</dl>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
[show source]
</a>
- <pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 223</span>
223: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>={})
224: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">asset_host</span>
225: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:call</span>)
226: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">?</span>
227: <span class="ruby-identifier">host</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">:call</span>).<span class="ruby-identifier">arity</span>
228: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>
229: <span class="ruby-identifier">request</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(
230: <span class="ruby-value str">'HTTPS'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">'on'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'off'</span>)
231: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">request</span>)
232: <span class="ruby-keyword kw">else</span>
233: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>)
234: <span class="ruby-keyword kw">end</span>
235: <span class="ruby-keyword kw">else</span>
236: <span class="ruby-identifier">host</span> <span class="ruby-operator">%=</span> (<span class="ruby-identifier">source</span>.<span class="ruby-identifier">hash</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/%d/</span>
237: <span class="ruby-keyword kw">end</span>
238: <span class="ruby-identifier">host</span>
239: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 263</span>
263: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>={})
264: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">asset_host</span>
265: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:call</span>)
266: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">?</span>
267: <span class="ruby-identifier">host</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">:call</span>).<span class="ruby-identifier">arity</span>
268: <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>
269: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">ActionDispatch</span>)
270: <span class="ruby-identifier">request_class</span> = <span class="ruby-constant">ActionDispatch</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>
271: <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># Rails 2.x</span>
272: <span class="ruby-identifier">request_class</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>
273: <span class="ruby-keyword kw">end</span>
274: <span class="ruby-identifier">request</span> = <span class="ruby-identifier">request_class</span>.<span class="ruby-identifier">new</span>(
275: <span class="ruby-value str">'HTTPS'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">'on'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'off'</span>)
276: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">request</span>)
277: <span class="ruby-keyword kw">else</span>
278: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">source</span>)
279: <span class="ruby-keyword kw">end</span>
280: <span class="ruby-keyword kw">else</span>
281: <span class="ruby-identifier">host</span> <span class="ruby-operator">%=</span> (<span class="ruby-identifier">source</span>.<span class="ruby-identifier">hash</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/%d/</span>
282: <span class="ruby-keyword kw">end</span>
283: <span class="ruby-identifier">host</span>
284: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-class' id='method-M000005'>
<a name='M000005'></a>
<div class='synopsis'>
@@ -429,16 +473,37 @@
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
[show source]
</a>
- <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 65</span>
65: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>
66: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">cache?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">blank?</span>
67: <span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>)).<span class="ruby-identifier">result</span>)
68: <span class="ruby-keyword kw">end</span>
69: <span class="ruby-ivar">@config</span>
70: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 47</span>
47: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">config</span>
48: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>)
49: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'`config/assets.yml` is missing! '</span> <span class="ruby-operator">+</span>
50: <span class="ruby-value str">'Run `rake asset_hat:config` to generate it.'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>
51: <span class="ruby-keyword kw">end</span>
52: 
53: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">cache?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">blank?</span>
54: <span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CONFIG_FILEPATH</span>)).<span class="ruby-identifier">result</span>)
55: <span class="ruby-keyword kw">end</span>
56: <span class="ruby-ivar">@config</span>
57: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000002'>
- <a name='M000002'></a>
+ <div class='method public-class' id='method-M000012'>
+ <a name='M000012'></a>
<div class='synopsis'>
+ <span class='name'>consider_all_requests_local?</span>
+ <span class='arguments'>()</span>
+ </div>
+ <div class='description'>
+ <p>
+ Returns the value of
+ <tt>Rails.application.config.consider_all_requests_local</tt> or its
+ equivalent in older versions of Rails. To modify this value, set
+ <tt>config.consider_all_requests_local</tt> (boolean) in your environment.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 185</span>
185: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">consider_all_requests_local?</span>
186: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rails</span>) <span class="ruby-operator">&&</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:application</span>)
187: <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">application</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">consider_all_requests_local</span>
188: <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># Rails 2.x</span>
189: <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">consider_all_requests_local</span>
190: <span class="ruby-keyword kw">end</span>
191: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-class' id='method-M000003'>
+ <a name='M000003'></a>
+ <div class='synopsis'>
<span class='name'>last_bundle_commit_id</span>
<span class='arguments'>(bundle, type)</span>
</div>
<div class='description'>
<p>
@@ -450,18 +515,18 @@
which of its files were most recently modified in the repository. If no ID
can be found, `nil` is returned.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
[show source]
</a>
- <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
46: <span class="ruby-comment cmt"># Process arguments</span>
47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
48: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
49: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Unknown type \"#{type}\"; should be one of: #{TYPES.join(', ')}."</span>
50: <span class="ruby-keyword kw">return</span>
51: <span class="ruby-keyword kw">end</span>
52: 
53: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>
55: <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
56: 
57: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>].<span class="ruby-identifier">blank?</span>
58: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
59: <span class="ruby-identifier">filepaths</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>
61: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">filepaths</span>)
62: <span class="ruby-keyword kw">end</span>
63: <span class="ruby-keyword kw">end</span>
64: 
65: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]
66: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_bundle_commit_id</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
46: <span class="ruby-comment cmt"># Process arguments</span>
47: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>
48: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type</span>)
49: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type "#{type}"; should be one of: #{TYPES.join(', ')}.}</span>
50: <span class="ruby-keyword kw">return</span>
51: <span class="ruby-keyword kw">end</span>
52: 
53: <span class="ruby-comment cmt"># Default to `{:css => {}, :js => {}}`</span>
54: <span class="ruby-ivar">@last_bundle_commit_ids</span> <span class="ruby-operator">||=</span>
55: <span class="ruby-constant">TYPES</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">hsh</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">t</span> =<span class="ruby-operator">></span> {}) }
56: 
57: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>].<span class="ruby-identifier">blank?</span>
58: <span class="ruby-identifier">dir</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">assets_dir</span>(<span class="ruby-identifier">type</span>)
59: <span class="ruby-identifier">filepaths</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bundle_filepaths</span>(<span class="ruby-identifier">bundle</span>, <span class="ruby-identifier">type</span>)
60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">filepaths</span>.<span class="ruby-identifier">present?</span>
61: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>] =
62: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">filepaths</span>)
63: <span class="ruby-keyword kw">end</span>
64: <span class="ruby-keyword kw">end</span>
65: 
66: <span class="ruby-ivar">@last_bundle_commit_ids</span>[<span class="ruby-identifier">type</span>][<span class="ruby-identifier">bundle</span>]
67: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000001'>
- <a name='M000001'></a>
+ <div class='method public-class' id='method-M000002'>
+ <a name='M000002'></a>
<div class='synopsis'>
<span class='name'>last_commit_id</span>
<span class='arguments'>(*args)</span>
</div>
<div class='description'>
@@ -479,18 +544,18 @@
</dd>
</dl>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
[show source]
</a>
- <pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 18</span>
18: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
19: <span class="ruby-comment cmt"># Process arguments</span>
20: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
21: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys</span>.<span class="ruby-identifier">reverse_merge</span>(<span class="ruby-identifier">:vcs</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:git</span>)
22: <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
23: 
24: <span class="ruby-comment cmt"># Validate options</span>
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:vcs</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">:git</span>
26: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Git is currently the only supported VCS.'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>
27: <span class="ruby-keyword kw">end</span>
28: 
29: <span class="ruby-ivar">@last_commit_ids</span> <span class="ruby-operator">||=</span> {}
30: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>].<span class="ruby-identifier">blank?</span>
31: <span class="ruby-identifier">h</span> = <span class="ruby-node">`git log -1 --pretty=format:%h #{filepaths} 2>/dev/null`</span>
32: <span class="ruby-comment cmt"># `h` has either the abbreviated Git commit hash or an empty string</span>
33: <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>] = <span class="ruby-identifier">h</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">present?</span>
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>]
36: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/asset_hat/vcs.rb, line 18</span>
18: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
19: <span class="ruby-comment cmt"># Process arguments</span>
20: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
21: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys</span>.<span class="ruby-identifier">reverse_merge</span>(<span class="ruby-identifier">:vcs</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:git</span>)
22: <span class="ruby-identifier">filepaths</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
23: 
24: <span class="ruby-comment cmt"># Validate options</span>
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:vcs</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">:git</span>
26: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Git is currently the only supported VCS.'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>
27: <span class="ruby-keyword kw">end</span>
28: 
29: <span class="ruby-ivar">@last_commit_ids</span> <span class="ruby-operator">||=</span> {}
30: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>].<span class="ruby-identifier">blank?</span>
31: <span class="ruby-identifier">h</span> = <span class="ruby-node">`git log -1 --pretty=format:%h #{filepaths} 2>/dev/null`</span>
32: <span class="ruby-comment cmt"># `h` has either the abbreviated Git commit hash or an empty string</span>
33: <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>] = <span class="ruby-identifier">h</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">present?</span>
34: <span class="ruby-keyword kw">end</span>
35: <span class="ruby-ivar">@last_commit_ids</span>[<span class="ruby-identifier">filepaths</span>]
36: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000010'>
- <a name='M000010'></a>
+ <div class='method public-class' id='method-M000013'>
+ <a name='M000013'></a>
<div class='synopsis'>
<span class='name'>min_filepath</span>
<span class='arguments'>(filepath, extension)</span>
</div>
<div class='description'>
@@ -498,23 +563,23 @@
Returns the expected path for the minified version of an asset:
</p>
<pre>AssetHat.min_filepath('public/stylesheets/bundles/application.css', 'css')
 # => 'public/stylesheets/bundles/application.min.css'</pre>
<p>
See also <tt><a
- href="AssetHat/CSS.html#M000016">AssetHat::CSS.min_filepath</a></tt> and
- <tt><a href="AssetHat/JS.html#M000022">AssetHat::JS.min_filepath</a></tt>.
+ href="AssetHat/CSS.html#M000019">AssetHat::CSS.min_filepath</a></tt> and
+ <tt><a href="AssetHat/JS.html#M000025">AssetHat::JS.min_filepath</a></tt>.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
[show source]
</a>
- <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 159</span>
159: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>, <span class="ruby-identifier">extension</span>)
160: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">/([^\.]*).#{extension}$/</span>, <span class="ruby-node">"\\1.min.#{extension}"</span>)
161: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 200</span>
200: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>, <span class="ruby-identifier">extension</span>)
201: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">/([^\.]*).#{extension}$/</span>, <span class="ruby-node">"\\1.min.#{extension}"</span>)
202: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000014'>
- <a name='M000014'></a>
+ <div class='method public-class' id='method-M000017'>
+ <a name='M000017'></a>
<div class='synopsis'>
<span class='name'>ssl_asset_host_differs?</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
@@ -522,31 +587,31 @@
Returns <tt>true</tt> if the asset host differs between SSL and non-SSL
pages, or <tt>false</tt> if the asset host doesn’t change.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
[show source]
</a>
- <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 243</span>
243: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ssl_asset_host_differs?</span>
244: <span class="ruby-identifier">asset_host</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">asset_host</span>
245: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>) <span class="ruby-operator">!=</span>
246: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>, <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
247: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/asset_hat.rb, line 288</span>
288: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ssl_asset_host_differs?</span>
289: <span class="ruby-identifier">asset_host</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">asset_host</span>
290: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>) <span class="ruby-operator">!=</span>
291: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(<span class="ruby-identifier">asset_host</span>, <span class="ruby-value str">'x.png'</span>, <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
292: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
- <div class='method public-class' id='method-M000004'>
- <a name='M000004'></a>
+ <div class='method public-class' id='method-M000001'>
+ <a name='M000001'></a>
<div class='synopsis'>
<span class='name'>version</span>
<span class='arguments'>()</span>
</div>
<div class='description'>
<p>
Returns this gem’s version number. See also VERSION.
</p>
</div>
<div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
+ <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
[show source]
</a>
- <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/asset_hat/version.rb, line 3</span>
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
4: <span class="ruby-identifier">data_filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-node">%w[.. .. VERSION.yml]</span>)
5: <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">data_filepath</span>, <span class="ruby-value str">'r'</span>))
6: [<span class="ruby-identifier">:major</span>, <span class="ruby-identifier">:minor</span>, <span class="ruby-identifier">:patch</span>, <span class="ruby-identifier">:build</span>].
7: <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">data</span>[<span class="ruby-identifier">x</span>] }.<span class="ruby-identifier">reject</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
8: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/asset_hat/version.rb, line 3</span>
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span>
4: <span class="ruby-identifier">data_filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-node">%w[.. .. VERSION.yml]</span>)
5: <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">data_filepath</span>, <span class="ruby-value str">'r'</span>))
6: [<span class="ruby-identifier">:major</span>, <span class="ruby-identifier">:minor</span>, <span class="ruby-identifier">:patch</span>, <span class="ruby-identifier">:build</span>].
7: <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">data</span>[<span class="ruby-identifier">x</span>] }.<span class="ruby-identifier">reject</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:blank?</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'.'</span>)
8: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>