compony 0.2.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +90 -13
  4. data/VERSION +1 -1
  5. data/compony.gemspec +4 -4
  6. data/doc/ComponentGenerator.html +1 -1
  7. data/doc/Components.html +1 -1
  8. data/doc/ComponentsGenerator.html +1 -1
  9. data/doc/Compony/Component.html +396 -334
  10. data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
  11. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
  12. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
  13. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
  14. data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
  15. data/doc/Compony/ComponentMixins/Default.html +1 -1
  16. data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
  17. data/doc/Compony/ComponentMixins.html +1 -1
  18. data/doc/Compony/Components/Button.html +3 -3
  19. data/doc/Compony/Components/Destroy.html +15 -15
  20. data/doc/Compony/Components/Edit.html +19 -19
  21. data/doc/Compony/Components/Form.html +87 -87
  22. data/doc/Compony/Components/New.html +15 -15
  23. data/doc/Compony/Components/WithForm.html +4 -4
  24. data/doc/Compony/Components.html +1 -1
  25. data/doc/Compony/ControllerMixin.html +1 -1
  26. data/doc/Compony/Engine.html +1 -1
  27. data/doc/Compony/MethodAccessibleHash.html +1 -1
  28. data/doc/Compony/ModelFields/Anchormodel.html +1 -1
  29. data/doc/Compony/ModelFields/Association.html +1 -1
  30. data/doc/Compony/ModelFields/Attachment.html +1 -1
  31. data/doc/Compony/ModelFields/Base.html +1 -1
  32. data/doc/Compony/ModelFields/Boolean.html +1 -1
  33. data/doc/Compony/ModelFields/Color.html +1 -1
  34. data/doc/Compony/ModelFields/Currency.html +1 -1
  35. data/doc/Compony/ModelFields/Date.html +1 -1
  36. data/doc/Compony/ModelFields/Datetime.html +1 -1
  37. data/doc/Compony/ModelFields/Decimal.html +1 -1
  38. data/doc/Compony/ModelFields/Email.html +1 -1
  39. data/doc/Compony/ModelFields/Float.html +1 -1
  40. data/doc/Compony/ModelFields/Integer.html +1 -1
  41. data/doc/Compony/ModelFields/Percentage.html +1 -1
  42. data/doc/Compony/ModelFields/Phone.html +1 -1
  43. data/doc/Compony/ModelFields/RichText.html +1 -1
  44. data/doc/Compony/ModelFields/String.html +1 -1
  45. data/doc/Compony/ModelFields/Text.html +1 -1
  46. data/doc/Compony/ModelFields/Time.html +1 -1
  47. data/doc/Compony/ModelFields/Url.html +1 -1
  48. data/doc/Compony/ModelFields.html +1 -1
  49. data/doc/Compony/ModelMixin.html +1 -1
  50. data/doc/Compony/NaturalOrdering.html +300 -0
  51. data/doc/Compony/RequestContext.html +84 -1
  52. data/doc/Compony/Version.html +1 -1
  53. data/doc/Compony/ViewHelpers.html +1 -1
  54. data/doc/Compony.html +3 -3
  55. data/doc/ComponyController.html +1 -1
  56. data/doc/_index.html +8 -1
  57. data/doc/class_list.html +1 -1
  58. data/doc/file.README.html +82 -16
  59. data/doc/index.html +82 -16
  60. data/doc/method_list.html +169 -161
  61. data/doc/top-level-namespace.html +1 -1
  62. data/lib/compony/component.rb +40 -52
  63. data/lib/compony/components/destroy.rb +9 -1
  64. data/lib/compony/components/edit.rb +2 -4
  65. data/lib/compony/components/form.rb +16 -5
  66. data/lib/compony/components/new.rb +5 -6
  67. data/lib/compony/components/with_form.rb +1 -1
  68. data/lib/compony/natural_ordering.rb +60 -0
  69. data/lib/compony/request_context.rb +14 -0
  70. data/lib/compony.rb +1 -0
  71. metadata +4 -2
@@ -143,6 +143,35 @@
143
143
 
144
144
  <span class="summary_desc"><div class='inline'></div></span>
145
145
 
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature">
151
+
152
+ <a href="#content_blocks-instance_method" title="#content_blocks (instance method)">#<strong>content_blocks</strong> &#x21d2; Object </a>
153
+
154
+
155
+
156
+ </span>
157
+
158
+
159
+
160
+
161
+ <span class="note title readonly">readonly</span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'>
172
+ <p>needed in RequestContext for nesting.</p>
173
+ </div></span>
174
+
146
175
  </li>
147
176
 
148
177
 
@@ -246,7 +275,7 @@
246
275
  <li class="public ">
247
276
  <span class="summary_signature">
248
277
 
249
- <a href="#add_content-instance_method" title="#add_content (instance method)">#<strong>add_content</strong>(index = -1,, &amp;block) &#x21d2; Object </a>
278
+ <a href="#before_render-instance_method" title="#before_render (instance method)">#<strong>before_render</strong>(name = :main, before: nil, **kwargs, &amp;block) &#x21d2; Object </a>
250
279
 
251
280
 
252
281
 
@@ -261,77 +290,9 @@
261
290
 
262
291
 
263
292
  <span class="summary_desc"><div class='inline'>
264
- <p>DSL method Adds a content block that will be executed after all previous ones.</p>
293
+ <p>DSL method Adds or overrides a before_render block.</p>
265
294
  </div></span>
266
295
 
267
- </li>
268
-
269
-
270
- <li class="public ">
271
- <span class="summary_signature">
272
-
273
- <a href="#before_render-instance_method" title="#before_render (instance method)">#<strong>before_render</strong>(&amp;block) &#x21d2; Object </a>
274
-
275
-
276
-
277
- </span>
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
- <span class="summary_desc"><div class='inline'>
288
- <p>DSL method.</p>
289
- </div></span>
290
-
291
- </li>
292
-
293
-
294
- <li class="public ">
295
- <span class="summary_signature">
296
-
297
- <a href="#comp_class_for-instance_method" title="#comp_class_for (instance method)">#<strong>comp_class_for</strong> &#x21d2; Object </a>
298
-
299
-
300
-
301
- </span>
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
- <span class="summary_desc"><div class='inline'></div></span>
312
-
313
- </li>
314
-
315
-
316
- <li class="public ">
317
- <span class="summary_signature">
318
-
319
- <a href="#comp_class_for!-instance_method" title="#comp_class_for! (instance method)">#<strong>comp_class_for!</strong> &#x21d2; Object </a>
320
-
321
-
322
-
323
- </span>
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
- <span class="summary_desc"><div class='inline'></div></span>
334
-
335
296
  </li>
336
297
 
337
298
 
@@ -386,7 +347,7 @@
386
347
  <li class="public ">
387
348
  <span class="summary_signature">
388
349
 
389
- <a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(&amp;block) &#x21d2; Object </a>
350
+ <a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(name = :main, before: nil, **kwargs, &amp;block) &#x21d2; Object </a>
390
351
 
391
352
 
392
353
 
@@ -401,7 +362,7 @@
401
362
 
402
363
 
403
364
  <span class="summary_desc"><div class='inline'>
404
- <p>DSL method Overrides previous content (also from superclasses).</p>
365
+ <p>DSL method Adds or overrides a content block.</p>
405
366
  </div></span>
406
367
 
407
368
  </li>
@@ -596,6 +557,30 @@
596
557
  <p>Returns a hash for the path.</p>
597
558
  </div></span>
598
559
 
560
+ </li>
561
+
562
+
563
+ <li class="public ">
564
+ <span class="summary_signature">
565
+
566
+ <a href="#remove_content-instance_method" title="#remove_content (instance method)">#<strong>remove_content</strong>(name) &#x21d2; Object </a>
567
+
568
+
569
+
570
+ </span>
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+ <span class="summary_desc"><div class='inline'>
581
+ <p>DSL method Removes a content block.</p>
582
+ </div></span>
583
+
599
584
  </li>
600
585
 
601
586
 
@@ -799,7 +784,6 @@
799
784
  <pre class="lines">
800
785
 
801
786
 
802
- 22
803
787
  23
804
788
  24
805
789
  25
@@ -817,19 +801,20 @@
817
801
  37
818
802
  38
819
803
  39
820
- 40</pre>
804
+ 40
805
+ 41</pre>
821
806
  </td>
822
807
  <td>
823
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 22</span>
808
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 23</span>
824
809
 
825
810
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_comp'>parent_comp</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
826
811
  <span class='ivar'>@parent_comp</span> <span class='op'>=</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
827
812
  <span class='ivar'>@sub_comps</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
828
813
  <span class='ivar'>@index</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
829
814
  <span class='ivar'>@comp_opts</span> <span class='op'>=</span> <span class='id identifier rubyid_comp_opts'>comp_opts</span>
830
- <span class='ivar'>@before_render_block</span> <span class='op'>=</span> <span class='kw'>nil</span>
831
- <span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
832
- <span class='ivar'>@actions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
815
+ <span class='ivar'>@before_render_blocks</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
816
+ <span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
817
+ <span class='ivar'>@actions</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
833
818
  <span class='ivar'>@skipped_actions</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
834
819
 
835
820
  <span class='id identifier rubyid_init_standalone'>init_standalone</span>
@@ -893,6 +878,49 @@
893
878
  </div>
894
879
 
895
880
 
881
+ <span id=""></span>
882
+ <div class="method_details ">
883
+ <h3 class="signature " id="content_blocks-instance_method">
884
+
885
+ #<strong>content_blocks</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
886
+
887
+
888
+
889
+
890
+
891
+ </h3><div class="docstring">
892
+ <div class="discussion">
893
+
894
+ <p>needed in RequestContext for nesting</p>
895
+
896
+
897
+ </div>
898
+ </div>
899
+ <div class="tags">
900
+
901
+
902
+ </div><table class="source_code">
903
+ <tr>
904
+ <td>
905
+ <pre class="lines">
906
+
907
+
908
+ 10
909
+ 11
910
+ 12</pre>
911
+ </td>
912
+ <td>
913
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 10</span>
914
+
915
+ <span class='kw'>def</span> <span class='id identifier rubyid_content_blocks'>content_blocks</span>
916
+ <span class='ivar'>@content_blocks</span>
917
+ <span class='kw'>end</span></pre>
918
+ </td>
919
+ </tr>
920
+ </table>
921
+ </div>
922
+
923
+
896
924
  <span id=""></span>
897
925
  <div class="method_details ">
898
926
  <h3 class="signature " id="parent_comp-instance_method">
@@ -966,15 +994,15 @@
966
994
  <pre class="lines">
967
995
 
968
996
 
969
- 15
970
997
  16
971
998
  17
972
999
  18
973
1000
  19
974
- 20</pre>
1001
+ 20
1002
+ 21</pre>
975
1003
  </td>
976
1004
  <td>
977
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 15</span>
1005
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 16</span>
978
1006
 
979
1007
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
980
1008
  <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>`setup` expects a block 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'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
@@ -1019,96 +1047,15 @@
1019
1047
  <pre class="lines">
1020
1048
 
1021
1049
 
1022
- 181
1023
- 182
1024
- 183
1025
- 184
1026
- 185
1027
- 186
1028
1050
  187
1029
1051
  188
1030
- 189
1031
- 190
1032
- 191
1033
- 192
1034
- 193
1035
- 194
1036
- 195
1037
- 196
1038
- 197
1039
- 198
1040
- 199
1041
- 200
1042
- 201</pre>
1052
+ 189</pre>
1043
1053
  </td>
1044
1054
  <td>
1045
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 181</span>
1055
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 187</span>
1046
1056
 
1047
1057
  <span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1048
- <span class='id identifier rubyid_action_name'>action_name</span> <span class='op'>=</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
1049
- <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'>&amp;.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
1050
- <span class='id identifier rubyid_action'>action</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='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>block:</span><span class='rparen'>)</span>
1051
-
1052
- <span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</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_action_name'>action_name</span> <span class='rbrace'>}</span>
1053
- <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> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1054
- <span class='ivar'>@actions</span><span class='period'>.</span><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> <span class='comment'># Replacing an existing element with a before: directive - must delete before calculating indices
1055
- </span> <span class='kw'>end</span>
1056
- <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>
1057
- <span class='id identifier rubyid_before_index'>before_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</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'>&quot;</span><span class='tstring_content'>Action </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_before_name'>before_name</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'>&quot;</span></span><span class='rparen'>)</span>
1058
- <span class='kw'>end</span>
1059
-
1060
- <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>
1061
- <span class='ivar'>@actions</span><span class='period'>.</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_action'>action</span><span class='rparen'>)</span>
1062
- <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>
1063
- <span class='ivar'>@actions</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_action'>action</span>
1064
- <span class='kw'>else</span>
1065
- <span class='ivar'>@actions</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_action'>action</span>
1066
- <span class='kw'>end</span>
1067
- <span class='kw'>end</span></pre>
1068
- </td>
1069
- </tr>
1070
- </table>
1071
- </div>
1072
-
1073
- <div class="method_details ">
1074
- <h3 class="signature " id="add_content-instance_method">
1075
-
1076
- #<strong>add_content</strong>(index = -1,, &amp;block) &#x21d2; <tt>Object</tt>
1077
-
1078
-
1079
-
1080
-
1081
-
1082
- </h3><div class="docstring">
1083
- <div class="discussion">
1084
-
1085
- <p>DSL method Adds a content block that will be executed after all previous ones. It is safe to use this method even if <code>content</code> has never been called You can use dyny here.</p>
1086
-
1087
-
1088
- </div>
1089
- </div>
1090
- <div class="tags">
1091
-
1092
-
1093
- </div><table class="source_code">
1094
- <tr>
1095
- <td>
1096
- <pre class="lines">
1097
-
1098
-
1099
- 141
1100
- 142
1101
- 143
1102
- 144
1103
- 145</pre>
1104
- </td>
1105
- <td>
1106
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 141</span>
1107
-
1108
- <span class='kw'>def</span> <span class='id identifier rubyid_add_content'>add_content</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1109
- <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>`content` expects a block 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'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
1110
- <span class='ivar'>@content_blocks</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1111
- <span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1058
+ <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='comma'>,</span> <span class='label'>before:</span><span class='rparen'>)</span>
1112
1059
  <span class='kw'>end</span></pre>
1113
1060
  </td>
1114
1061
  </tr>
@@ -1118,7 +1065,7 @@
1118
1065
  <div class="method_details ">
1119
1066
  <h3 class="signature " id="before_render-instance_method">
1120
1067
 
1121
- #<strong>before_render</strong>(&amp;block) &#x21d2; <tt>Object</tt>
1068
+ #<strong>before_render</strong>(name = :main, before: nil, **kwargs, &amp;block) &#x21d2; <tt>Object</tt>
1122
1069
 
1123
1070
 
1124
1071
 
@@ -1127,107 +1074,69 @@
1127
1074
  </h3><div class="docstring">
1128
1075
  <div class="discussion">
1129
1076
 
1130
- <p>DSL method</p>
1077
+ <p>DSL method Adds or overrides a before_render block. You can use controller.redirect_to to redirect away and halt the before_render/content chain</p>
1131
1078
 
1132
1079
 
1133
1080
  </div>
1134
1081
  </div>
1135
1082
  <div class="tags">
1083
+ <p class="tag_title">Parameters:</p>
1084
+ <ul class="param">
1136
1085
 
1137
-
1138
- </div><table class="source_code">
1139
- <tr>
1140
- <td>
1141
- <pre class="lines">
1142
-
1143
-
1144
- 125
1145
- 126
1146
- 127</pre>
1147
- </td>
1148
- <td>
1149
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 125</span>
1150
-
1151
- <span class='kw'>def</span> <span class='id identifier rubyid_before_render'>before_render</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1152
- <span class='ivar'>@before_render_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1153
- <span class='kw'>end</span></pre>
1154
- </td>
1155
- </tr>
1156
- </table>
1086
+ <li>
1087
+
1088
+ <span class='name'>name</span>
1089
+
1090
+
1091
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
1092
+
1093
+
1094
+ <em class="default">(defaults to: <tt>:main</tt>)</em>
1095
+
1096
+
1097
+ &mdash;
1098
+ <div class='inline'>
1099
+ <p>The name of the before_render block, defaults to <code>:main</code></p>
1157
1100
  </div>
1158
-
1159
- <div class="method_details ">
1160
- <h3 class="signature " id="comp_class_for-instance_method">
1161
-
1162
- #<strong>comp_class_for</strong> &#x21d2; <tt>Object</tt>
1163
-
1164
-
1165
-
1166
-
1101
+
1102
+ </li>
1167
1103
 
1168
- </h3><div class="docstring">
1169
- <div class="discussion">
1170
-
1171
- <div class="note todo">
1172
- <strong>TODO:</strong>
1173
- <div class='inline'>
1174
- <p>deprecate (check for usages beforehand)</p>
1175
- </div>
1176
- </div>
1177
-
1178
-
1179
-
1180
- </div>
1104
+ <li>
1105
+
1106
+ <span class='name'>before</span>
1107
+
1108
+
1109
+ <span class='type'>(<tt>nil</tt>, <tt>Symbol</tt>, <tt>String</tt>)</span>
1110
+
1111
+
1112
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1113
+
1114
+
1115
+ &mdash;
1116
+ <div class='inline'>
1117
+ <p>If nil, the block will be added to the bottom of the before_render chain. Otherwise, pass the name of another block.</p>
1181
1118
  </div>
1182
- <div class="tags">
1119
+
1120
+ </li>
1183
1121
 
1184
-
1185
- </div><table class="source_code">
1186
- <tr>
1187
- <td>
1188
- <pre class="lines">
1189
-
1190
-
1191
- 115
1192
- 116
1193
- 117</pre>
1194
- </td>
1195
- <td>
1196
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 115</span>
1197
-
1198
- <span class='kw'>def</span> <span class='id identifier rubyid_comp_class_for'>comp_class_for</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
1199
- <span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for'><span class='object_link'><a href="../Compony.html#comp_class_for-class_method" title="Compony.comp_class_for (method)">comp_class_for</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
1200
- <span class='kw'>end</span></pre>
1201
- </td>
1202
- </tr>
1203
- </table>
1122
+ <li>
1123
+
1124
+ <span class='name'>block</span>
1125
+
1126
+
1127
+ <span class='type'>(<tt>Proc</tt>)</span>
1128
+
1129
+
1130
+
1131
+ &mdash;
1132
+ <div class='inline'>
1133
+ <p>The block that should be run as part of the before_render pipeline. Will run in the component’s context.</p>
1204
1134
  </div>
1205
-
1206
- <div class="method_details ">
1207
- <h3 class="signature " id="comp_class_for!-instance_method">
1208
-
1209
- #<strong>comp_class_for!</strong> &#x21d2; <tt>Object</tt>
1210
-
1211
-
1212
-
1213
-
1135
+
1136
+ </li>
1214
1137
 
1215
- </h3><div class="docstring">
1216
- <div class="discussion">
1217
-
1218
- <div class="note todo">
1219
- <strong>TODO:</strong>
1220
- <div class='inline'>
1221
- <p>deprecate (check for usages beforehand)</p>
1222
- </div>
1223
- </div>
1224
-
1225
-
1138
+ </ul>
1226
1139
 
1227
- </div>
1228
- </div>
1229
- <div class="tags">
1230
-
1231
1140
 
1232
1141
  </div><table class="source_code">
1233
1142
  <tr>
@@ -1235,15 +1144,17 @@
1235
1144
  <pre class="lines">
1236
1145
 
1237
1146
 
1238
- 120
1239
1147
  121
1240
- 122</pre>
1148
+ 122
1149
+ 123
1150
+ 124</pre>
1241
1151
  </td>
1242
1152
  <td>
1243
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 120</span>
1153
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 121</span>
1244
1154
 
1245
- <span class='kw'>def</span> <span class='id identifier rubyid_comp_class_for!'>comp_class_for!</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
1246
- <span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for!'><span class='object_link'><a href="../Compony.html#comp_class_for!-class_method" title="Compony.comp_class_for! (method)">comp_class_for!</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
1155
+ <span class='kw'>def</span> <span class='id identifier rubyid_before_render'>before_render</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='symbol'>:main</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='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1156
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>`before_render` expects a block 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'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
1157
+ <span class='ivar'>@before_render_blocks</span><span class='period'>.</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_block'>block</span><span class='comma'>,</span> <span class='label'>before:</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
1247
1158
  <span class='kw'>end</span></pre>
1248
1159
  </td>
1249
1160
  </tr>
@@ -1276,12 +1187,12 @@
1276
1187
  <pre class="lines">
1277
1188
 
1278
1189
 
1279
- 105
1280
1190
  106
1281
- 107</pre>
1191
+ 107
1192
+ 108</pre>
1282
1193
  </td>
1283
1194
  <td>
1284
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 105</span>
1195
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 106</span>
1285
1196
 
1286
1197
  <span class='kw'>def</span> <span class='id identifier rubyid_comp_cst'>comp_cst</span>
1287
1198
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
@@ -1317,12 +1228,12 @@
1317
1228
  <pre class="lines">
1318
1229
 
1319
1230
 
1320
- 110
1321
1231
  111
1322
- 112</pre>
1232
+ 112
1233
+ 113</pre>
1323
1234
  </td>
1324
1235
  <td>
1325
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 110</span>
1236
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 111</span>
1326
1237
 
1327
1238
  <span class='kw'>def</span> <span class='id identifier rubyid_comp_name'>comp_name</span>
1328
1239
  <span class='id identifier rubyid_comp_cst'>comp_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
@@ -1335,7 +1246,7 @@
1335
1246
  <div class="method_details ">
1336
1247
  <h3 class="signature " id="content-instance_method">
1337
1248
 
1338
- #<strong>content</strong>(&amp;block) &#x21d2; <tt>Object</tt>
1249
+ #<strong>content</strong>(name = :main, before: nil, **kwargs, &amp;block) &#x21d2; <tt>Object</tt>
1339
1250
 
1340
1251
 
1341
1252
 
@@ -1344,13 +1255,85 @@
1344
1255
  </h3><div class="docstring">
1345
1256
  <div class="discussion">
1346
1257
 
1347
- <p>DSL method Overrides previous content (also from superclasses). Will be the first content block to run. You can use dyny here.</p>
1258
+ <p>DSL method Adds or overrides a content block.</p>
1348
1259
 
1349
1260
 
1350
1261
  </div>
1351
1262
  </div>
1352
1263
  <div class="tags">
1264
+ <p class="tag_title">Parameters:</p>
1265
+ <ul class="param">
1266
+
1267
+ <li>
1268
+
1269
+ <span class='name'>name</span>
1270
+
1271
+
1272
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
1273
+
1274
+
1275
+ <em class="default">(defaults to: <tt>:main</tt>)</em>
1276
+
1277
+
1278
+ &mdash;
1279
+ <div class='inline'>
1280
+ <p>The name of the content block, defaults to <code>:main</code></p>
1281
+ </div>
1282
+
1283
+ </li>
1353
1284
 
1285
+ <li>
1286
+
1287
+ <span class='name'>before</span>
1288
+
1289
+
1290
+ <span class='type'>(<tt>nil</tt>, <tt>Symbol</tt>, <tt>String</tt>)</span>
1291
+
1292
+
1293
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1294
+
1295
+
1296
+ &mdash;
1297
+ <div class='inline'>
1298
+ <p>If nil, the block will be added to the bottom of the content chain. Otherwise, pass the name of another block.</p>
1299
+ </div>
1300
+
1301
+ </li>
1302
+
1303
+ <li>
1304
+
1305
+ <span class='name'>kwargs</span>
1306
+
1307
+
1308
+ <span class='type'>(<tt>Hash</tt>)</span>
1309
+
1310
+
1311
+
1312
+ &mdash;
1313
+ <div class='inline'>
1314
+ <p>If hidden is true, the content will not be rendered by default, allowing you to nest it in another content block.</p>
1315
+ </div>
1316
+
1317
+ </li>
1318
+
1319
+ <li>
1320
+
1321
+ <span class='name'>block</span>
1322
+
1323
+
1324
+ <span class='type'>(<tt>Proc</tt>)</span>
1325
+
1326
+
1327
+
1328
+ &mdash;
1329
+ <div class='inline'>
1330
+ <p>The block that should be run as part of the content pipeline. Will run in the component’s context. You can use Dyny here.</p>
1331
+ </div>
1332
+
1333
+ </li>
1334
+
1335
+ </ul>
1336
+
1354
1337
 
1355
1338
  </div><table class="source_code">
1356
1339
  <tr>
@@ -1361,14 +1344,20 @@
1361
1344
  132
1362
1345
  133
1363
1346
  134
1364
- 135</pre>
1347
+ 135
1348
+ 136
1349
+ 137
1350
+ 138</pre>
1365
1351
  </td>
1366
1352
  <td>
1367
1353
  <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 132</span>
1368
1354
 
1369
- <span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1370
- <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>`content` expects a block 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'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
1371
- <span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_block'>block</span><span class='rbracket'>]</span>
1355
+ <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='op'>=</span> <span class='symbol'>:main</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='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1356
+ <span class='comment'># A block is required here, but if this is an override (e.g. to hide another content block), we can tolerate the missing block.
1357
+ </span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@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_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_b'>b</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='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1358
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>`content` expects a block 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'>&quot;</span></span><span class='rparen'>)</span>
1359
+ <span class='kw'>end</span>
1360
+ <span class='ivar'>@content_blocks</span><span class='period'>.</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_block'>block</span> <span class='op'>||</span> <span class='symbol'>:missing</span><span class='comma'>,</span> <span class='label'>before:</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
1372
1361
  <span class='kw'>end</span></pre>
1373
1362
  </td>
1374
1363
  </tr>
@@ -1401,12 +1390,12 @@
1401
1390
  <pre class="lines">
1402
1391
 
1403
1392
 
1404
- 95
1405
1393
  96
1406
- 97</pre>
1394
+ 97
1395
+ 98</pre>
1407
1396
  </td>
1408
1397
  <td>
1409
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 95</span>
1398
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 96</span>
1410
1399
 
1411
1400
  <span class='kw'>def</span> <span class='id identifier rubyid_family_cst'>family_cst</span>
1412
1401
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_module_parent'>module_parent</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
@@ -1442,12 +1431,12 @@
1442
1431
  <pre class="lines">
1443
1432
 
1444
1433
 
1445
- 100
1446
1434
  101
1447
- 102</pre>
1435
+ 102
1436
+ 103</pre>
1448
1437
  </td>
1449
1438
  <td>
1450
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 100</span>
1439
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 101</span>
1451
1440
 
1452
1441
  <span class='kw'>def</span> <span class='id identifier rubyid_family_name'>family_name</span>
1453
1442
  <span class='id identifier rubyid_family_cst'>family_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
@@ -1483,12 +1472,12 @@
1483
1472
  <pre class="lines">
1484
1473
 
1485
1474
 
1486
- 61
1487
1475
  62
1488
- 63</pre>
1476
+ 63
1477
+ 64</pre>
1489
1478
  </td>
1490
1479
  <td>
1491
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 61</span>
1480
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 62</span>
1492
1481
 
1493
1482
  <span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
1494
1483
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_family_name'>family_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comp_name'>comp_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='ivar'>@index</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
@@ -1522,12 +1511,12 @@
1522
1511
  <pre class="lines">
1523
1512
 
1524
1513
 
1525
- 42
1526
1514
  43
1527
- 44</pre>
1515
+ 44
1516
+ 45</pre>
1528
1517
  </td>
1529
1518
  <td>
1530
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 42</span>
1519
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 43</span>
1531
1520
 
1532
1521
  <span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
1533
1522
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>#&lt;</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash'>hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>&gt;</span><span class='tstring_end'>&quot;</span></span>
@@ -1563,12 +1552,12 @@
1563
1552
  <pre class="lines">
1564
1553
 
1565
1554
 
1566
- 83
1567
1555
  84
1568
- 85</pre>
1556
+ 85
1557
+ 86</pre>
1569
1558
  </td>
1570
1559
  <td>
1571
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 83</span>
1560
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 84</span>
1572
1561
 
1573
1562
  <span class='kw'>def</span> <span class='id identifier rubyid_param_name'>param_name</span><span class='lparen'>(</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='rparen'>)</span>
1574
1563
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_hash'>path_hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
@@ -1604,16 +1593,16 @@
1604
1593
  <pre class="lines">
1605
1594
 
1606
1595
 
1607
- 67
1608
1596
  68
1609
1597
  69
1610
1598
  70
1611
1599
  71
1612
1600
  72
1613
- 73</pre>
1601
+ 73
1602
+ 74</pre>
1614
1603
  </td>
1615
1604
  <td>
1616
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 67</span>
1605
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 68</span>
1617
1606
 
1618
1607
  <span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
1619
1608
  <span class='kw'>if</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
@@ -1653,12 +1642,12 @@
1653
1642
  <pre class="lines">
1654
1643
 
1655
1644
 
1656
- 77
1657
1645
  78
1658
- 79</pre>
1646
+ 79
1647
+ 80</pre>
1659
1648
  </td>
1660
1649
  <td>
1661
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 77</span>
1650
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 78</span>
1662
1651
 
1663
1652
  <span class='kw'>def</span> <span class='id identifier rubyid_path_hash'>path_hash</span>
1664
1653
  <span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>..</span><span class='int'>4</span><span class='rbracket'>]</span>
@@ -1666,6 +1655,71 @@
1666
1655
  </td>
1667
1656
  </tr>
1668
1657
  </table>
1658
+ </div>
1659
+
1660
+ <div class="method_details ">
1661
+ <h3 class="signature " id="remove_content-instance_method">
1662
+
1663
+ #<strong>remove_content</strong>(name) &#x21d2; <tt>Object</tt>
1664
+
1665
+
1666
+
1667
+
1668
+
1669
+ </h3><div class="docstring">
1670
+ <div class="discussion">
1671
+
1672
+ <p>DSL method Removes a content block. Use this in subclasses if a content block defined in the parent should be removed from the child.</p>
1673
+
1674
+
1675
+ </div>
1676
+ </div>
1677
+ <div class="tags">
1678
+ <p class="tag_title">Parameters:</p>
1679
+ <ul class="param">
1680
+
1681
+ <li>
1682
+
1683
+ <span class='name'>name</span>
1684
+
1685
+
1686
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
1687
+
1688
+
1689
+
1690
+ &mdash;
1691
+ <div class='inline'>
1692
+ <p>Name of the content block that should be removed</p>
1693
+ </div>
1694
+
1695
+ </li>
1696
+
1697
+ </ul>
1698
+
1699
+
1700
+ </div><table class="source_code">
1701
+ <tr>
1702
+ <td>
1703
+ <pre class="lines">
1704
+
1705
+
1706
+ 143
1707
+ 144
1708
+ 145
1709
+ 146
1710
+ 147</pre>
1711
+ </td>
1712
+ <td>
1713
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 143</span>
1714
+
1715
+ <span class='kw'>def</span> <span class='id identifier rubyid_remove_content'>remove_content</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1716
+ <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>
1717
+ <span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='ivar'>@content_blocks</span><span class='period'>.</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> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</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 for removal 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'>&quot;</span></span><span class='rparen'>)</span>
1718
+ <span class='ivar'>@content_blocks</span><span class='period'>.</span><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>
1719
+ <span class='kw'>end</span></pre>
1720
+ </td>
1721
+ </tr>
1722
+ </table>
1669
1723
  </div>
1670
1724
 
1671
1725
  <div class="method_details ">
@@ -1716,8 +1770,6 @@
1716
1770
  <pre class="lines">
1717
1771
 
1718
1772
 
1719
- 150
1720
- 151
1721
1773
  152
1722
1774
  153
1723
1775
  154
@@ -1742,15 +1794,25 @@
1742
1794
  173
1743
1795
  174
1744
1796
  175
1745
- 176</pre>
1797
+ 176
1798
+ 177
1799
+ 178
1800
+ 179
1801
+ 180
1802
+ 181
1803
+ 182</pre>
1746
1804
  </td>
1747
1805
  <td>
1748
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 150</span>
1806
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 152</span>
1749
1807
 
1750
1808
  <span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>standalone:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_locals'>locals</span><span class='rparen'>)</span>
1751
- <span class='comment'># Call before_render hook if any and backfire instance variables back to the component
1752
- </span> <span class='comment'># TODO: Can .request_context be removed from the next line? Test well!
1753
- </span> <span class='const'><span class='object_link'><a href="RequestContext.html" title="Compony::RequestContext (class)">RequestContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RequestContext.html#initialize-instance_method" title="Compony::RequestContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>locals:</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_request_context'><span class='object_link'><a href="RequestContext.html#request_context-instance_method" title="Compony::RequestContext#request_context (method)">request_context</a></span></span><span class='period'>.</span><span class='id identifier rubyid_evaluate_with_backfire'>evaluate_with_backfire</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='ivar'>@before_render_block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@before_render_block</span>
1809
+ <span class='comment'># Call before_render hooks (if any) and backfire instance variables back to the component
1810
+ </span> <span class='ivar'>@before_render_blocks</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_element'>element</span><span class='op'>|</span>
1811
+ <span class='const'><span class='object_link'><a href="RequestContext.html" title="Compony::RequestContext (class)">RequestContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RequestContext.html#initialize-instance_method" title="Compony::RequestContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>locals:</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_evaluate_with_backfire'><span class='object_link'><a href="RequestContext.html#evaluate_with_backfire-instance_method" title="Compony::RequestContext#evaluate_with_backfire (method)">evaluate_with_backfire</a></span></span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
1812
+ <span class='comment'># Stop if a `before_render` block issued a body (e.g. through redirecting)
1813
+ </span> <span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1814
+ <span class='kw'>end</span>
1815
+
1754
1816
  <span class='comment'># Render, unless before_render has already issued a body (e.g. through redirecting).
1755
1817
  </span> <span class='kw'>if</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1756
1818
  <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must define `content` or set a response body in `before_render`</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span>
@@ -1761,9 +1823,9 @@
1761
1823
  <span class='tstring_content'> if Compony.content_before_root_comp_block &amp;&amp; standalone
1762
1824
  </span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&amp;Compony.content_before_root_comp_block)
1763
1825
  </span><span class='tstring_content'> end
1764
- </span><span class='tstring_content'> content_blocks.each do |block|
1826
+ </span><span class='tstring_content'> content_blocks.reject{ |el| el.hidden }.each do |element|
1765
1827
  </span><span class='tstring_content'> # Instanciate and evaluate a fresh RequestContext in order to use the buffer allocated by the ActionView (needed for `concat` calls)
1766
- </span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&amp;block)
1828
+ </span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&amp;element.payload)
1767
1829
  </span><span class='tstring_content'> end
1768
1830
  </span><span class='tstring_content'> if Compony.content_after_root_comp_block &amp;&amp; standalone
1769
1831
  </span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&amp;Compony.content_after_root_comp_block)
@@ -1805,25 +1867,25 @@
1805
1867
  <pre class="lines">
1806
1868
 
1807
1869
 
1870
+ 198
1871
+ 199
1872
+ 200
1873
+ 201
1874
+ 202
1875
+ 203
1876
+ 204
1877
+ 205
1878
+ 206
1879
+ 207
1880
+ 208
1881
+ 209
1808
1882
  210
1809
1883
  211
1810
1884
  212
1811
- 213
1812
- 214
1813
- 215
1814
- 216
1815
- 217
1816
- 218
1817
- 219
1818
- 220
1819
- 221
1820
- 222
1821
- 223
1822
- 224
1823
- 225</pre>
1885
+ 213</pre>
1824
1886
  </td>
1825
1887
  <td>
1826
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 210</span>
1888
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 198</span>
1827
1889
 
1828
1890
  <span class='kw'>def</span> <span class='id identifier rubyid_render_actions'>render_actions</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>wrapper_class:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>action_class:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1829
1891
  <span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_helpers'>helpers</span>
@@ -1831,7 +1893,7 @@
1831
1893
  <span class='id identifier rubyid_button_htmls'>button_htmls</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_action'>action</span><span class='op'>|</span>
1832
1894
  <span class='kw'>next</span> <span class='kw'>if</span> <span class='ivar'>@skipped_actions</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
1833
1895
  <span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with_button_defaults'><span class='object_link'><a href="../Compony.html#with_button_defaults-class_method" title="Compony.with_button_defaults (method)">with_button_defaults</a></span></span><span class='lparen'>(</span><span class='label'>feasibility_action:</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='kw'>do</span>
1834
- <span class='id identifier rubyid_action_button'>action_button</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
1896
+ <span class='id identifier rubyid_action_button'>action_button</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_payload'>payload</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
1835
1897
  <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_action_button'>action_button</span>
1836
1898
  <span class='id identifier rubyid_button_html'>button_html</span> <span class='op'>=</span> <span class='id identifier rubyid_action_button'>action_button</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
1837
1899
  <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_button_html'>button_html</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
@@ -1885,12 +1947,12 @@
1885
1947
  <pre class="lines">
1886
1948
 
1887
1949
 
1888
- 228
1889
- 229
1890
- 230</pre>
1950
+ 216
1951
+ 217
1952
+ 218</pre>
1891
1953
  </td>
1892
1954
  <td>
1893
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 228</span>
1955
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 216</span>
1894
1956
 
1895
1957
  <span class='kw'>def</span> <span class='id identifier rubyid_resourceful?'>resourceful?</span>
1896
1958
  <span class='kw'>return</span> <span class='kw'>false</span>
@@ -1926,13 +1988,13 @@
1926
1988
  <pre class="lines">
1927
1989
 
1928
1990
 
1929
- 48
1930
1991
  49
1931
1992
  50
1932
- 51</pre>
1993
+ 51
1994
+ 52</pre>
1933
1995
  </td>
1934
1996
  <td>
1935
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 48</span>
1997
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 49</span>
1936
1998
 
1937
1999
  <span class='kw'>def</span> <span class='id identifier rubyid_root_comp'>root_comp</span>
1938
2000
  <span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>unless</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
@@ -1982,12 +2044,12 @@
1982
2044
  <pre class="lines">
1983
2045
 
1984
2046
 
1985
- 55
1986
2047
  56
1987
- 57</pre>
2048
+ 57
2049
+ 58</pre>
1988
2050
  </td>
1989
2051
  <td>
1990
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 55</span>
2052
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 56</span>
1991
2053
 
1992
2054
  <span class='kw'>def</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
1993
2055
  <span class='id identifier rubyid_parent_comp'>parent_comp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -2023,12 +2085,12 @@
2023
2085
  <pre class="lines">
2024
2086
 
2025
2087
 
2026
- 205
2027
- 206
2028
- 207</pre>
2088
+ 193
2089
+ 194
2090
+ 195</pre>
2029
2091
  </td>
2030
2092
  <td>
2031
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 205</span>
2093
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 193</span>
2032
2094
 
2033
2095
  <span class='kw'>def</span> <span class='id identifier rubyid_skip_action'>skip_action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span>
2034
2096
  <span class='ivar'>@skipped_actions</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
@@ -2064,14 +2126,14 @@
2064
2126
  <pre class="lines">
2065
2127
 
2066
2128
 
2067
- 88
2068
2129
  89
2069
2130
  90
2070
2131
  91
2071
- 92</pre>
2132
+ 92
2133
+ 93</pre>
2072
2134
  </td>
2073
2135
  <td>
2074
- <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 88</span>
2136
+ <pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 89</span>
2075
2137
 
2076
2138
  <span class='kw'>def</span> <span class='id identifier rubyid_sub_comp'>sub_comp</span><span class='lparen'>(</span><span class='id identifier rubyid_component_class'>component_class</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
2077
2139
  <span class='id identifier rubyid_sub'>sub</span> <span class='op'>=</span> <span class='id identifier rubyid_component_class'>component_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='ivar'>@sub_comps</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
@@ -2088,7 +2150,7 @@
2088
2150
  </div>
2089
2151
 
2090
2152
  <div id="footer">
2091
- Generated on Sat Apr 27 10:22:12 2024 by
2153
+ Generated on Fri May 31 14:28:30 2024 by
2092
2154
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2093
2155
  0.9.34 (ruby-3.2.2).
2094
2156
  </div>