compony 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +80 -13
- data/VERSION +1 -1
- data/compony.gemspec +4 -4
- data/doc/ComponentGenerator.html +1 -1
- data/doc/Components.html +1 -1
- data/doc/ComponentsGenerator.html +1 -1
- data/doc/Compony/Component.html +308 -341
- data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
- data/doc/Compony/ComponentMixins/Default.html +1 -1
- data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
- data/doc/Compony/ComponentMixins.html +1 -1
- data/doc/Compony/Components/Button.html +3 -3
- data/doc/Compony/Components/Destroy.html +3 -3
- data/doc/Compony/Components/Edit.html +19 -19
- data/doc/Compony/Components/Form.html +3 -3
- data/doc/Compony/Components/New.html +19 -19
- data/doc/Compony/Components/WithForm.html +4 -4
- data/doc/Compony/Components.html +1 -1
- data/doc/Compony/ControllerMixin.html +1 -1
- data/doc/Compony/Engine.html +1 -1
- data/doc/Compony/MethodAccessibleHash.html +1 -1
- data/doc/Compony/ModelFields/Anchormodel.html +1 -1
- data/doc/Compony/ModelFields/Association.html +1 -1
- data/doc/Compony/ModelFields/Attachment.html +1 -1
- data/doc/Compony/ModelFields/Base.html +1 -1
- data/doc/Compony/ModelFields/Boolean.html +1 -1
- data/doc/Compony/ModelFields/Color.html +1 -1
- data/doc/Compony/ModelFields/Currency.html +1 -1
- data/doc/Compony/ModelFields/Date.html +1 -1
- data/doc/Compony/ModelFields/Datetime.html +1 -1
- data/doc/Compony/ModelFields/Decimal.html +1 -1
- data/doc/Compony/ModelFields/Email.html +1 -1
- data/doc/Compony/ModelFields/Float.html +1 -1
- data/doc/Compony/ModelFields/Integer.html +1 -1
- data/doc/Compony/ModelFields/Percentage.html +1 -1
- data/doc/Compony/ModelFields/Phone.html +1 -1
- data/doc/Compony/ModelFields/RichText.html +1 -1
- data/doc/Compony/ModelFields/String.html +1 -1
- data/doc/Compony/ModelFields/Text.html +1 -1
- data/doc/Compony/ModelFields/Time.html +1 -1
- data/doc/Compony/ModelFields/Url.html +1 -1
- data/doc/Compony/ModelFields.html +1 -1
- data/doc/Compony/ModelMixin.html +1 -1
- data/doc/Compony/NaturalOrdering.html +292 -0
- data/doc/Compony/RequestContext.html +72 -1
- data/doc/Compony/Version.html +1 -1
- data/doc/Compony/ViewHelpers.html +1 -1
- data/doc/Compony.html +3 -3
- data/doc/ComponyController.html +1 -1
- data/doc/_index.html +8 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +73 -16
- data/doc/index.html +73 -16
- data/doc/method_list.html +100 -100
- data/doc/top-level-namespace.html +1 -1
- data/lib/compony/component.rb +30 -54
- data/lib/compony/components/edit.rb +2 -4
- data/lib/compony/components/new.rb +4 -6
- data/lib/compony/components/with_form.rb +1 -1
- data/lib/compony/natural_ordering.rb +56 -0
- data/lib/compony/request_context.rb +8 -0
- data/lib/compony.rb +1 -0
- metadata +4 -2
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -289,7 +289,7 @@
|
|
289
289
|
</div>
|
290
290
|
|
291
291
|
<div id="footer">
|
292
|
-
Generated on
|
292
|
+
Generated on Wed May 29 15:53:00 2024 by
|
293
293
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
294
294
|
0.9.34 (ruby-3.2.2).
|
295
295
|
</div>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -230,7 +230,7 @@
|
|
230
230
|
</div>
|
231
231
|
|
232
232
|
<div id="footer">
|
233
|
-
Generated on
|
233
|
+
Generated on Wed May 29 15:53:00 2024 by
|
234
234
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
235
235
|
0.9.34 (ruby-3.2.2).
|
236
236
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -291,7 +291,7 @@
|
|
291
291
|
</div>
|
292
292
|
|
293
293
|
<div id="footer">
|
294
|
-
Generated on
|
294
|
+
Generated on Wed May 29 15:53:00 2024 by
|
295
295
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
296
296
|
0.9.34 (ruby-3.2.2).
|
297
297
|
</div>
|
@@ -222,7 +222,7 @@
|
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div id="footer">
|
225
|
-
Generated on
|
225
|
+
Generated on Wed May 29 15:53:00 2024 by
|
226
226
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
227
227
|
0.9.34 (ruby-3.2.2).
|
228
228
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -144,7 +144,7 @@
|
|
144
144
|
</div>
|
145
145
|
|
146
146
|
<div id="footer">
|
147
|
-
Generated on
|
147
|
+
Generated on Wed May 29 15:53:00 2024 by
|
148
148
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
149
149
|
0.9.34 (ruby-3.2.2).
|
150
150
|
</div>
|
@@ -230,7 +230,7 @@
|
|
230
230
|
</div>
|
231
231
|
|
232
232
|
<div id="footer">
|
233
|
-
Generated on
|
233
|
+
Generated on Wed May 29 15:53:00 2024 by
|
234
234
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
235
235
|
0.9.34 (ruby-3.2.2).
|
236
236
|
</div>
|
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Wed May 29 15:53:00 2024 by
|
120
120
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.9.34 (ruby-3.2.2).
|
122
122
|
</div>
|
data/doc/Compony/ModelMixin.html
CHANGED
@@ -514,7 +514,7 @@
|
|
514
514
|
</div>
|
515
515
|
|
516
516
|
<div id="footer">
|
517
|
-
Generated on
|
517
|
+
Generated on Wed May 29 15:53:00 2024 by
|
518
518
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
519
519
|
0.9.34 (ruby-3.2.2).
|
520
520
|
</div>
|
@@ -0,0 +1,292 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Compony::NaturalOrdering
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Compony::NaturalOrdering";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (N)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">NaturalOrdering</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Compony::NaturalOrdering
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Array</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Array</li>
|
78
|
+
|
79
|
+
<li class="next">Compony::NaturalOrdering</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/compony/natural_ordering.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>This class provides an array-based data structure where elements have symbol names. New elements can be appended or placed at a location using <code>before:</code>. Important: do not mutate this class with any other method call than the natural_-prefixed methods defined below. Example:<br></p>
|
108
|
+
|
109
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='op'>::</span><span class='const'>NaturalOrdering</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
110
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='symbol'>:a</span><span class='comma'>,</span> <span class='id identifier rubyid_a_payload'>a_payload</span><span class='rparen'>)</span>
|
111
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='symbol'>:c</span><span class='comma'>,</span> <span class='id identifier rubyid_c_payload'>c_payload</span><span class='rparen'>)</span>
|
112
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='symbol'>:b</span><span class='comma'>,</span> <span class='id identifier rubyid_b_payload'>b_payload</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='symbol'>:c</span><span class='rparen'>)</span>
|
113
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='symbol'>:d</span><span class='comma'>,</span> <span class='id identifier rubyid_d_payload'>d_payload</span><span class='comma'>,</span> <span class='label'>hidden:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
114
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='symbol'>:a</span><span class='comma'>,</span> <span class='id identifier rubyid_a_new_payload'>a_new_payload</span><span class='rparen'>)</span> <span class='comment'># overwrites :a
|
115
|
+
</span>
|
116
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_hidden'>hidden</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:name</span><span class='rparen'>)</span> <span class='comment'># --> :a, :b, :c
|
117
|
+
</span><span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:payload</span><span class='rparen'>)</span> <span class='comment'># --> a_new_payload, b_payload, c_payload, d_payload
|
118
|
+
</span></code></pre>
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<div class="tags">
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<h2>
|
135
|
+
Instance Method Summary
|
136
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
137
|
+
</h2>
|
138
|
+
|
139
|
+
<ul class="summary">
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#natural_push-instance_method" title="#natural_push (instance method)">#<strong>natural_push</strong>(name, payload, before: nil, **kwargs) ⇒ Object </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
</ul>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<div id="instance_method_details" class="method_details_list">
|
170
|
+
<h2>Instance Method Details</h2>
|
171
|
+
|
172
|
+
|
173
|
+
<div class="method_details first">
|
174
|
+
<h3 class="signature first" id="natural_push-instance_method">
|
175
|
+
|
176
|
+
#<strong>natural_push</strong>(name, payload, before: nil, **kwargs) ⇒ <tt>Object</tt>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</h3><div class="docstring">
|
183
|
+
<div class="discussion">
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
<div class="tags">
|
189
|
+
|
190
|
+
|
191
|
+
</div><table class="source_code">
|
192
|
+
<tr>
|
193
|
+
<td>
|
194
|
+
<pre class="lines">
|
195
|
+
|
196
|
+
|
197
|
+
18
|
198
|
+
19
|
199
|
+
20
|
200
|
+
21
|
201
|
+
22
|
202
|
+
23
|
203
|
+
24
|
204
|
+
25
|
205
|
+
26
|
206
|
+
27
|
207
|
+
28
|
208
|
+
29
|
209
|
+
30
|
210
|
+
31
|
211
|
+
32
|
212
|
+
33
|
213
|
+
34
|
214
|
+
35
|
215
|
+
36
|
216
|
+
37
|
217
|
+
38
|
218
|
+
39
|
219
|
+
40
|
220
|
+
41
|
221
|
+
42
|
222
|
+
43
|
223
|
+
44
|
224
|
+
45
|
225
|
+
46
|
226
|
+
47
|
227
|
+
48
|
228
|
+
49
|
229
|
+
50
|
230
|
+
51
|
231
|
+
52
|
232
|
+
53
|
233
|
+
54</pre>
|
234
|
+
</td>
|
235
|
+
<td>
|
236
|
+
<pre class="code"><span class="info file"># File 'lib/compony/natural_ordering.rb', line 18</span>
|
237
|
+
|
238
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_payload'>payload</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
239
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
240
|
+
<span class='id identifier rubyid_before_name'>before_name</span> <span class='op'>=</span> <span class='id identifier rubyid_before'>before</span><span class='op'>&.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
241
|
+
<span class='id identifier rubyid_old_kwargs'>old_kwargs</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
242
|
+
|
243
|
+
<span class='comment'># Fetch existing element if any
|
244
|
+
</span> <span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span>
|
245
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
246
|
+
<span class='comment'># Copy all non-mentionned kwargs from the element we are about to overwrite
|
247
|
+
</span> <span class='id identifier rubyid_old_kwargs'>old_kwargs</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_except'>except</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:payload</span><span class='rparen'>)</span>
|
248
|
+
|
249
|
+
<span class='comment'># Replacing an existing element with a before: directive - must delete before calculating indices
|
250
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
251
|
+
<span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rparen'>)</span>
|
252
|
+
<span class='kw'>end</span>
|
253
|
+
<span class='kw'>end</span>
|
254
|
+
|
255
|
+
<span class='comment'># Fetch before element
|
256
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
257
|
+
<span class='id identifier rubyid_before_index'>before_index</span> <span class='op'>=</span> <span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_before_name'>before_name</span> <span class='rbrace'>}</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Element </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> for :before not found in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
258
|
+
<span class='kw'>end</span>
|
259
|
+
|
260
|
+
<span class='comment'># Create the element to insert
|
261
|
+
</span> <span class='id identifier rubyid_element'>element</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="MethodAccessibleHash.html" title="Compony::MethodAccessibleHash (class)">MethodAccessibleHash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="MethodAccessibleHash.html#initialize-instance_method" title="Compony::MethodAccessibleHash#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span><span class='comma'>,</span> <span class='label'>payload:</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_old_kwargs'>old_kwargs</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
262
|
+
|
263
|
+
<span class='comment'># Insert new element
|
264
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_before_index'>before_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
265
|
+
<span class='comment'># Insert before another element
|
266
|
+
</span> <span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_before_index'>before_index</span><span class='comma'>,</span> <span class='id identifier rubyid_element'>element</span><span class='rparen'>)</span>
|
267
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
268
|
+
<span class='comment'># Override another element
|
269
|
+
</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_element'>element</span>
|
270
|
+
<span class='kw'>else</span>
|
271
|
+
<span class='comment'># Append at the end
|
272
|
+
</span> <span class='kw'>self</span> <span class='op'><<</span> <span class='id identifier rubyid_element'>element</span>
|
273
|
+
<span class='kw'>end</span>
|
274
|
+
<span class='kw'>end</span></pre>
|
275
|
+
</td>
|
276
|
+
</tr>
|
277
|
+
</table>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
</div>
|
281
|
+
|
282
|
+
</div>
|
283
|
+
|
284
|
+
<div id="footer">
|
285
|
+
Generated on Wed May 29 15:53:00 2024 by
|
286
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
287
|
+
0.9.34 (ruby-3.2.2).
|
288
|
+
</div>
|
289
|
+
|
290
|
+
</div>
|
291
|
+
</body>
|
292
|
+
</html>
|
@@ -234,6 +234,30 @@
|
|
234
234
|
|
235
235
|
<span class="summary_desc"><div class='inline'></div></span>
|
236
236
|
|
237
|
+
</li>
|
238
|
+
|
239
|
+
|
240
|
+
<li class="public ">
|
241
|
+
<span class="summary_signature">
|
242
|
+
|
243
|
+
<a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(name) ⇒ Object </a>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
</span>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
<span class="summary_desc"><div class='inline'>
|
258
|
+
<p>Renders a content block from the current component.</p>
|
259
|
+
</div></span>
|
260
|
+
|
237
261
|
</li>
|
238
262
|
|
239
263
|
|
@@ -640,6 +664,53 @@
|
|
640
664
|
</td>
|
641
665
|
</tr>
|
642
666
|
</table>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div class="method_details ">
|
670
|
+
<h3 class="signature " id="content-instance_method">
|
671
|
+
|
672
|
+
#<strong>content</strong>(name) ⇒ <tt>Object</tt>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
</h3><div class="docstring">
|
679
|
+
<div class="discussion">
|
680
|
+
|
681
|
+
<p>Renders a content block from the current component.</p>
|
682
|
+
|
683
|
+
|
684
|
+
</div>
|
685
|
+
</div>
|
686
|
+
<div class="tags">
|
687
|
+
|
688
|
+
|
689
|
+
</div><table class="source_code">
|
690
|
+
<tr>
|
691
|
+
<td>
|
692
|
+
<pre class="lines">
|
693
|
+
|
694
|
+
|
695
|
+
46
|
696
|
+
47
|
697
|
+
48
|
698
|
+
49
|
699
|
+
50
|
700
|
+
51</pre>
|
701
|
+
</td>
|
702
|
+
<td>
|
703
|
+
<pre class="code"><span class="info file"># File 'lib/compony/request_context.rb', line 46</span>
|
704
|
+
|
705
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
706
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
707
|
+
<span class='id identifier rubyid_content_block'>content_block</span> <span class='op'>=</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_content_blocks'>content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Content block </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> not found in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
708
|
+
<span class='comment'># A fresh RequestContext is needed due to Rails' buffer
|
709
|
+
</span> <span class='id identifier rubyid_concat'>concat</span> <span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Compony::RequestContext (class)">RequestContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Compony::RequestContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>helpers:</span><span class='comma'>,</span> <span class='label'>locals:</span> <span class='id identifier rubyid_local_assigns'>local_assigns</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_evaluate'>evaluate</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_content_block'>content_block</span><span class='period'>.</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
|
710
|
+
<span class='kw'>end</span></pre>
|
711
|
+
</td>
|
712
|
+
</tr>
|
713
|
+
</table>
|
643
714
|
</div>
|
644
715
|
|
645
716
|
<div class="method_details ">
|
@@ -781,7 +852,7 @@
|
|
781
852
|
</div>
|
782
853
|
|
783
854
|
<div id="footer">
|
784
|
-
Generated on
|
855
|
+
Generated on Wed May 29 15:53:00 2024 by
|
785
856
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
786
857
|
0.9.34 (ruby-3.2.2).
|
787
858
|
</div>
|
data/doc/Compony/Version.html
CHANGED
@@ -129,7 +129,7 @@
|
|
129
129
|
</div>
|
130
130
|
|
131
131
|
<div id="footer">
|
132
|
-
Generated on
|
132
|
+
Generated on Wed May 29 15:53:00 2024 by
|
133
133
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
134
134
|
0.9.34 (ruby-3.2.2).
|
135
135
|
</div>
|
@@ -433,7 +433,7 @@
|
|
433
433
|
</div>
|
434
434
|
|
435
435
|
<div id="footer">
|
436
|
-
Generated on
|
436
|
+
Generated on Wed May 29 15:53:00 2024 by
|
437
437
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
438
438
|
0.9.34 (ruby-3.2.2).
|
439
439
|
</div>
|