landline/doc/Hyde/DSL/PathMethods.html

691 lines
16 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Hyde::DSL::PathMethods
&mdash; Documentation by YARD 0.9.34
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Hyde::DSL::PathMethods";
relpath = '../../';
</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 class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (P)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Hyde.html" title="Hyde (module)">Hyde</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../DSL.html" title="Hyde::DSL (module)">DSL</a></span></span>
&raquo;
<span class="title">PathMethods</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Hyde::DSL::PathMethods
</h1>
<div class="box_info">
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="../PathContext.html" title="Hyde::PathContext (class)">PathContext</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/hyde/dsl/methods_path.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Common path methods</p>
</div>
</div>
<div class="tags">
</div>
<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="#filter-instance_method" title="#filter (instance method)">#<strong>filter</strong>(&amp;block) {|request| ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Add a filter to the path.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#index-instance_method" title="#index (instance method)">#<strong>index</strong>(index) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Set path index.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#postprocess-instance_method" title="#postprocess (instance method)">#<strong>postprocess</strong>(&amp;block) {|request, response| ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Add a postprocessor to the path.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#preprocess-instance_method" title="#preprocess (instance method)">#<strong>preprocess</strong>(&amp;block) {|request| ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Add a preprocessor to the path.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#remap-instance_method" title="#remap (instance method)">#<strong>remap</strong>(path) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Set root path (without appending matched part).</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#root-instance_method" title="#root (instance method)">#<strong>root</strong>(path) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>Set root path (appends matched part of the path).</p>
</div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="filter-instance_method">
#<strong>filter</strong>(&amp;block) {|request| ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Add a filter to the path.
Blocks path access if a filter returns false.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>block</span>
<span class='type'>(<tt>#call</tt>)</span>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>request</span>
<span class='type'>(<tt><span class='object_link'><a href="../Request.html" title="Hyde::Request (class)">Hyde::Request</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
55
56
57
58</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 55</span>
<span class='kw'>def</span> <span class='id identifier rubyid_filter'>filter</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_filter'>filter</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='id identifier rubyid_block'>block</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="index-instance_method">
#<strong>index</strong>(index) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Set path index</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>index</span>
<span class='type'>(<tt>Array</tt>, <tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
10
11
12
13
14
15
16
17
18
19</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 10</span>
<span class='kw'>def</span> <span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_index'>index</span>
<span class='kw'>when</span> <span class='const'>Array</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>index</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
<span class='kw'>when</span> <span class='const'>String</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>index</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>StandardError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>index should be an Array or a String</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="postprocess-instance_method">
#<strong>postprocess</strong>(&amp;block) {|request, response| ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Add a postprocessor to the path.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>block</span>
<span class='type'>(<tt>#call</tt>)</span>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>request</span>
<span class='type'>(<tt><span class='object_link'><a href="../Request.html" title="Hyde::Request (class)">Hyde::Request</a></span></tt>)</span>
</li>
<li>
<span class='name'>response</span>
<span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Hyde::Response (class)">Hyde::Response</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_postprocess'>postprocess</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_postprocess'>postprocess</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='id identifier rubyid_block'>block</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="preprocess-instance_method">
#<strong>preprocess</strong>(&amp;block) {|request| ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Add a preprocessor to the path.
Does not modify path execution.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>block</span>
<span class='type'>(<tt>#call</tt>)</span>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>request</span>
<span class='type'>(<tt><span class='object_link'><a href="../Request.html" title="Hyde::Request (class)">Hyde::Request</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
37
38
39
40</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 37</span>
<span class='kw'>def</span> <span class='id identifier rubyid_preprocess'>preprocess</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_preprocess'>preprocess</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='id identifier rubyid_block'>block</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="remap-instance_method">
#<strong>remap</strong>(path) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Set root path (without appending matched part).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'><p>ath [String</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
29
30
31</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 29</span>
<span class='kw'>def</span> <span class='id identifier rubyid_remap'>remap</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_remap'>remap</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="root-instance_method">
#<strong>root</strong>(path) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Set root path (appends matched part of the path).</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'><p>ath [String</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/hyde/dsl/methods_path.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_root'><span class='object_link'><a href="../../top-level-namespace.html" title="Top Level Namespace (root)">root</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
<span class='ivar'>@origin</span><span class='period'>.</span><span class='id identifier rubyid_root'><span class='object_link'><a href="../../top-level-namespace.html" title="Top Level Namespace (root)">root</a></span></span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Wed Sep 13 02:08:01 2023 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.0.6).
</div>
</div>
</body>
</html>