ovto 0.4.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +15 -2
  5. data/Gemfile +2 -2
  6. data/Gemfile.lock +23 -27
  7. data/README.md +2 -2
  8. data/book/SUMMARY.md +3 -1
  9. data/book/api/actions.md +1 -1
  10. data/book/api/fetch.md +3 -3
  11. data/book/api/middleware.md +99 -0
  12. data/book/api/pure_component.md +30 -0
  13. data/book/guides/install.md +76 -0
  14. data/book/guides/tutorial.md +3 -3
  15. data/book/ovtologo.png +0 -0
  16. data/docs/api/Array.html +190 -0
  17. data/docs/api/Hash.html +196 -0
  18. data/docs/api/Ovto/Actions.html +132 -40
  19. data/docs/api/Ovto/App.html +254 -40
  20. data/docs/api/Ovto/Component/MoreThanOneNode.html +6 -6
  21. data/docs/api/Ovto/Component.html +102 -27
  22. data/docs/api/Ovto/Middleware/Actions.html +428 -0
  23. data/docs/api/Ovto/Middleware/Base.html +606 -0
  24. data/docs/api/Ovto/Middleware/Component.html +355 -0
  25. data/docs/api/Ovto/Middleware.html +288 -0
  26. data/docs/api/Ovto/PureComponent/StateIsNotAvailable.html +124 -0
  27. data/docs/api/Ovto/PureComponent.html +368 -0
  28. data/docs/api/Ovto/Runtime.html +7 -7
  29. data/docs/api/Ovto/State/MissingValue.html +6 -6
  30. data/docs/api/Ovto/State/{UnknownKey.html → UnknownStateKey.html} +11 -11
  31. data/docs/api/Ovto/State.html +59 -43
  32. data/docs/api/Ovto/WiredActionSet.html +636 -0
  33. data/docs/api/Ovto/WiredActions.html +78 -35
  34. data/docs/api/Ovto.html +226 -29
  35. data/docs/api/_index.html +99 -11
  36. data/docs/api/actions.html +36 -10
  37. data/docs/api/app.html +35 -9
  38. data/docs/api/class_list.html +3 -3
  39. data/docs/api/component.html +37 -11
  40. data/docs/api/css/style.css +2 -2
  41. data/docs/api/fetch.html +40 -14
  42. data/docs/api/file.README.html +8 -8
  43. data/docs/api/file_list.html +2 -2
  44. data/docs/api/frames.html +2 -2
  45. data/docs/api/index.html +8 -8
  46. data/docs/api/js/app.js +14 -3
  47. data/docs/api/method_list.html +318 -22
  48. data/docs/api/middleware.html +498 -0
  49. data/docs/api/pure_component.html +428 -0
  50. data/docs/api/state.html +35 -9
  51. data/docs/api/top-level-namespace.html +9 -7
  52. data/docs/gitbook/gitbook.js +2 -2
  53. data/docs/gitbook/theme.js +1 -1
  54. data/docs/guides/debugging.html +35 -9
  55. data/docs/guides/development.html +35 -9
  56. data/docs/guides/install.html +452 -0
  57. data/docs/guides/tutorial.html +101 -66
  58. data/docs/index.html +37 -17
  59. data/docs/ovtologo.png +0 -0
  60. data/docs/search_index.json +1 -1
  61. data/examples/sinatra/Gemfile +2 -0
  62. data/examples/sinatra/Gemfile.lock +33 -31
  63. data/examples/sinatra/app.rb +1 -4
  64. data/examples/sinatra/config.ru +6 -6
  65. data/examples/static/Gemfile.lock +10 -14
  66. data/lib/ovto/actions.rb +11 -0
  67. data/lib/ovto/app.rb +37 -13
  68. data/lib/ovto/component.rb +149 -73
  69. data/lib/ovto/fetch.rb +1 -1
  70. data/lib/ovto/middleware.rb +121 -0
  71. data/lib/ovto/pure_component.rb +22 -0
  72. data/lib/ovto/state.rb +13 -5
  73. data/lib/ovto/version.rb +1 -1
  74. data/lib/ovto/wired_action_set.rb +40 -0
  75. data/lib/ovto/wired_actions.rb +49 -11
  76. data/lib/ovto.rb +27 -0
  77. data/ovto.gemspec +1 -1
  78. metadata +35 -9
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Class: Ovto::WiredActions
8
8
 
9
- &mdash; Documentation by YARD 0.9.19
9
+ &mdash; Documentation by YARD 0.9.24
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
14
 
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
16
 
17
- <script type="text/javascript" charset="utf-8">
17
+ <script type="text/javascript">
18
18
  pathId = "Ovto::WiredActions";
19
19
  relpath = '../';
20
20
  </script>
@@ -141,7 +141,7 @@
141
141
  <li class="public ">
142
142
  <span class="summary_signature">
143
143
 
144
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(actions, app, runtime) &#x21d2; WiredActions </a>
144
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(actions, app, runtime, parent) &#x21d2; WiredActions </a>
145
145
 
146
146
 
147
147
 
@@ -158,7 +158,7 @@
158
158
 
159
159
 
160
160
  <span class="summary_desc"><div class='inline'>
161
- <p>A new instance of WiredActions.</p>
161
+ <p>Create a WiredActions.</p>
162
162
  </div></span>
163
163
 
164
164
  </li>
@@ -217,7 +217,7 @@
217
217
  <div class="method_details first">
218
218
  <h3 class="signature first" id="initialize-instance_method">
219
219
 
220
- #<strong>initialize</strong>(actions, app, runtime) &#x21d2; <tt><span class='object_link'><a href="" title="Ovto::WiredActions (class)">WiredActions</a></span></tt>
220
+ #<strong>initialize</strong>(actions, app, runtime, parent) &#x21d2; <tt><span class='object_link'><a href="" title="Ovto::WiredActions (class)">WiredActions</a></span></tt>
221
221
 
222
222
 
223
223
 
@@ -226,7 +226,16 @@
226
226
  </h3><div class="docstring">
227
227
  <div class="discussion">
228
228
 
229
- <p>Returns a new instance of WiredActions</p>
229
+ <p>Create a WiredActions</p>
230
+ <ul><li>
231
+ <p>actions: Ovto::Actions</p>
232
+ </li><li>
233
+ <p>app: Ovto::App</p>
234
+ </li><li>
235
+ <p>runtime: Ovto::Runtime (to call scheduleRender after state change)</p>
236
+ </li><li>
237
+ <p>parent: WiredActionSet</p>
238
+ </li></ul>
230
239
 
231
240
 
232
241
  </div>
@@ -240,15 +249,15 @@
240
249
  <pre class="lines">
241
250
 
242
251
 
243
- 6
244
- 7
245
- 8</pre>
252
+ 12
253
+ 13
254
+ 14</pre>
246
255
  </td>
247
256
  <td>
248
- <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 6</span>
257
+ <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 12</span>
249
258
 
250
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_actions'>actions</span><span class='comma'>,</span> <span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_runtime'>runtime</span><span class='rparen'>)</span>
251
- <span class='ivar'>@actions</span><span class='comma'>,</span> <span class='ivar'>@app</span><span class='comma'>,</span> <span class='ivar'>@runtime</span> <span class='op'>=</span> <span class='id identifier rubyid_actions'>actions</span><span class='comma'>,</span> <span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_runtime'>runtime</span>
259
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_actions'>actions</span><span class='comma'>,</span> <span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_runtime'>runtime</span><span class='comma'>,</span> <span class='id identifier rubyid_parent'>parent</span><span class='rparen'>)</span>
260
+ <span class='ivar'>@actions</span><span class='comma'>,</span> <span class='ivar'>@app</span><span class='comma'>,</span> <span class='ivar'>@runtime</span><span class='comma'>,</span> <span class='ivar'>@parent</span> <span class='op'>=</span> <span class='id identifier rubyid_actions'>actions</span><span class='comma'>,</span> <span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='id identifier rubyid_runtime'>runtime</span><span class='comma'>,</span> <span class='id identifier rubyid_parent'>parent</span>
252
261
  <span class='kw'>end</span></pre>
253
262
  </td>
254
263
  </tr>
@@ -272,25 +281,59 @@
272
281
 
273
282
 
274
283
 
275
- </h3><table class="source_code">
284
+ </h3><div class="docstring">
285
+ <div class="discussion">
286
+
287
+
288
+ </div>
289
+ </div>
290
+ <div class="tags">
291
+
292
+ <p class="tag_title">Raises:</p>
293
+ <ul class="raise">
294
+
295
+ <li>
296
+
297
+
298
+ <span class='type'>(<tt>NoMethodError</tt>)</span>
299
+
300
+
301
+
302
+ </li>
303
+
304
+ </ul>
305
+
306
+ </div><table class="source_code">
276
307
  <tr>
277
308
  <td>
278
309
  <pre class="lines">
279
310
 
280
311
 
281
- 10
282
- 11
283
- 12
284
- 13
285
- 14</pre>
312
+ 16
313
+ 17
314
+ 18
315
+ 19
316
+ 20
317
+ 21
318
+ 22
319
+ 23
320
+ 24
321
+ 25
322
+ 26</pre>
286
323
  </td>
287
324
  <td>
288
- <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 10</span>
325
+ <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 16</span>
289
326
 
290
327
  <span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_args_hash'>args_hash</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
291
- <span class='const'><span class='object_link'><a href="../Ovto.html" title="Ovto (module)">Ovto</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log_error'><span class='object_link'><a href="../Ovto.html#log_error-class_method" title="Ovto.log_error (method)">log_error</a></span></span> <span class='lbrace'>{</span>
292
- <span class='id identifier rubyid_invoke_action'>invoke_action</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_args_hash'>args_hash</span><span class='rparen'>)</span>
293
- <span class='rbrace'>}</span>
328
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NoMethodError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>undefined method `</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39; on </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
329
+ <span class='kw'>if</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
330
+ <span class='const'><span class='object_link'><a href="../Ovto.html" title="Ovto (module)">Ovto</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log_error'><span class='object_link'><a href="../Ovto.html#log_error-class_method" title="Ovto.log_error (method)">log_error</a></span></span> <span class='lbrace'>{</span>
331
+ <span class='const'><span class='object_link'><a href="../Ovto.html" title="Ovto (module)">Ovto</a></span></span><span class='period'>.</span><span class='id identifier rubyid_debug_trace_log'><span class='object_link'><a href="../Ovto.html#debug_trace_log-class_method" title="Ovto.debug_trace_log (method)">debug_trace_log</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invoke action \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; on </span><span class='embexpr_beg'>#{</span><span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
332
+ <span class='id identifier rubyid_invoke_action'>invoke_action</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_args_hash'>args_hash</span><span class='rparen'>)</span>
333
+ <span class='rbrace'>}</span>
334
+ <span class='kw'>else</span>
335
+ <span class='ivar'>@parent</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="WiredActionSet.html" title="Ovto::WiredActionSet (class)">WiredActionSet</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WiredActionSet.html#THE_MIDDLEWARE_ITSELF-constant" title="Ovto::WiredActionSet::THE_MIDDLEWARE_ITSELF (constant)">THE_MIDDLEWARE_ITSELF</a></span></span><span class='rbracket'>]</span> <span class='comment'># WiredActions of a middleware named `name`
336
+ </span> <span class='kw'>end</span>
294
337
  <span class='kw'>end</span></pre>
295
338
  </td>
296
339
  </tr>
@@ -330,12 +373,12 @@
330
373
  <pre class="lines">
331
374
 
332
375
 
333
- 21
334
- 22
335
- 23</pre>
376
+ 33
377
+ 34
378
+ 35</pre>
336
379
  </td>
337
380
  <td>
338
- <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 21</span>
381
+ <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 33</span>
339
382
 
340
383
  <span class='kw'>def</span> <span class='id identifier rubyid__app'>_app</span>
341
384
  <span class='ivar'>@app</span>
@@ -382,15 +425,15 @@
382
425
  <pre class="lines">
383
426
 
384
427
 
385
- 16
386
- 17
387
- 18</pre>
428
+ 28
429
+ 29
430
+ 30</pre>
388
431
  </td>
389
432
  <td>
390
- <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 16</span>
433
+ <pre class="code"><span class="info file"># File 'lib/ovto/wired_actions.rb', line 28</span>
391
434
 
392
435
  <span class='kw'>def</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
393
- <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
436
+ <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='ivar'>@parent</span><span class='period'>.</span><span class='id identifier rubyid_middleware_names'>middleware_names</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
394
437
  <span class='kw'>end</span></pre>
395
438
  </td>
396
439
  </tr>
@@ -402,9 +445,9 @@
402
445
  </div>
403
446
 
404
447
  <div id="footer">
405
- Generated on Fri Apr 19 12:51:39 2019 by
448
+ Generated on Sat Feb 29 23:26:32 2020 by
406
449
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
407
- 0.9.19 (ruby-2.5.5).
450
+ 0.9.24 (ruby-2.5.5).
408
451
  </div>
409
452
 
410
453
  </div>
data/docs/api/Ovto.html CHANGED
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Module: Ovto
8
8
 
9
- &mdash; Documentation by YARD 0.9.19
9
+ &mdash; Documentation by YARD 0.9.24
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
16
 
17
- <script type="text/javascript" charset="utf-8">
17
+ <script type="text/javascript">
18
18
  pathId = "Ovto";
19
19
  relpath = '';
20
20
  </script>
@@ -79,7 +79,7 @@
79
79
  <dl>
80
80
  <dt>Defined in:</dt>
81
81
  <dd>lib/ovto.rb<span class="defines">,<br />
82
- lib/ovto/app.rb,<br /> lib/ovto/fetch.rb,<br /> lib/ovto/state.rb,<br /> lib/ovto/actions.rb,<br /> lib/ovto/runtime.rb,<br /> lib/ovto/version.rb,<br /> lib/ovto/component.rb,<br /> lib/ovto/wired_actions.rb</span>
82
+ lib/ovto/app.rb,<br /> lib/ovto/fetch.rb,<br /> lib/ovto/state.rb,<br /> lib/ovto/actions.rb,<br /> lib/ovto/runtime.rb,<br /> lib/ovto/version.rb,<br /> lib/ovto/component.rb,<br /> lib/ovto/middleware.rb,<br /> lib/ovto/wired_actions.rb,<br /> lib/ovto/pure_component.rb,<br /> lib/ovto/wired_action_set.rb</span>
83
83
  </dd>
84
84
  </dl>
85
85
 
@@ -89,9 +89,11 @@
89
89
  <p class="children">
90
90
 
91
91
 
92
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Ovto/Middleware.html" title="Ovto::Middleware (module)">Middleware</a></span>
93
+
92
94
 
93
95
 
94
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Ovto/Actions.html" title="Ovto::Actions (class)">Actions</a></span>, <span class='object_link'><a href="Ovto/App.html" title="Ovto::App (class)">App</a></span>, <span class='object_link'><a href="Ovto/Component.html" title="Ovto::Component (class)">Component</a></span>, <span class='object_link'><a href="Ovto/Runtime.html" title="Ovto::Runtime (class)">Runtime</a></span>, <span class='object_link'><a href="Ovto/State.html" title="Ovto::State (class)">State</a></span>, <span class='object_link'><a href="Ovto/WiredActions.html" title="Ovto::WiredActions (class)">WiredActions</a></span>
96
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Ovto/Actions.html" title="Ovto::Actions (class)">Actions</a></span>, <span class='object_link'><a href="Ovto/App.html" title="Ovto::App (class)">App</a></span>, <span class='object_link'><a href="Ovto/Component.html" title="Ovto::Component (class)">Component</a></span>, <span class='object_link'><a href="Ovto/PureComponent.html" title="Ovto::PureComponent (class)">PureComponent</a></span>, <span class='object_link'><a href="Ovto/Runtime.html" title="Ovto::Runtime (class)">Runtime</a></span>, <span class='object_link'><a href="Ovto/State.html" title="Ovto::State (class)">State</a></span>, <span class='object_link'><a href="Ovto/WiredActionSet.html" title="Ovto::WiredActionSet (class)">WiredActionSet</a></span>, <span class='object_link'><a href="Ovto/WiredActions.html" title="Ovto::WiredActions (class)">WiredActions</a></span>
95
97
 
96
98
 
97
99
  </p>
@@ -107,7 +109,12 @@
107
109
  <dt id="VERSION-constant" class="">VERSION =
108
110
 
109
111
  </dt>
110
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.4.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
112
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.6.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
113
+
114
+ <dt id="VALID_NAME_REXP-constant" class="">VALID_NAME_REXP =
115
+
116
+ </dt>
117
+ <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[a-zA-Z0-9_]+\z</span><span class='regexp_end'>/</span></span></pre></dd>
111
118
 
112
119
  </dl>
113
120
 
@@ -285,6 +292,56 @@
285
292
  <p>Call block.</p>
286
293
  </div></span>
287
294
 
295
+ </li>
296
+
297
+
298
+ <li class="public ">
299
+ <span class="summary_signature">
300
+
301
+ <a href="#Middleware-class_method" title="Middleware (class method)">.<strong>Middleware</strong>(name) &#x21d2; Object </a>
302
+
303
+
304
+
305
+ </span>
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+ <span class="summary_desc"><div class='inline'>
316
+ <p>Create an ancestor of middleware class Example: class MiddlewareExample
317
+ &lt; Ovto::Middleware(“middleware_example”).</p>
318
+ </div></span>
319
+
320
+ </li>
321
+
322
+
323
+ <li class="public ">
324
+ <span class="summary_signature">
325
+
326
+ <a href="#send_args_with_state-class_method" title="send_args_with_state (class method)">.<strong>send_args_with_state</strong>(obj, meth, args, state, &amp;block) &#x21d2; Object </a>
327
+
328
+
329
+
330
+ </span>
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+ <span class="summary_desc"><div class='inline'>
341
+ <p>Something like `obj.meth(state: state, **args, &amp;block)` Safe even if
342
+ `obj.meth` does not have `state:`.</p>
343
+ </div></span>
344
+
288
345
  </li>
289
346
 
290
347
 
@@ -385,10 +442,10 @@
385
442
  <pre class="lines">
386
443
 
387
444
 
388
- 19</pre>
445
+ 22</pre>
389
446
  </td>
390
447
  <td>
391
- <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 19</span>
448
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 22</span>
392
449
 
393
450
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_debug_trace'>debug_trace</span><span class='semicolon'>;</span> <span class='ivar'>@debug_trace</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
394
451
  </td>
@@ -411,10 +468,10 @@
411
468
  <pre class="lines">
412
469
 
413
470
 
414
- 20</pre>
471
+ 23</pre>
415
472
  </td>
416
473
  <td>
417
- <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 20</span>
474
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 23</span>
418
475
 
419
476
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_debug_trace='>debug_trace=</span><span class='lparen'>(</span><span class='id identifier rubyid_bool'>bool</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='ivar'>@debug_trace</span> <span class='op'>=</span> <span class='id identifier rubyid_bool'>bool</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
420
477
  </td>
@@ -437,12 +494,12 @@
437
494
  <pre class="lines">
438
495
 
439
496
 
440
- 21
441
- 22
442
- 23</pre>
497
+ 24
498
+ 25
499
+ 26</pre>
443
500
  </td>
444
501
  <td>
445
- <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 21</span>
502
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 24</span>
446
503
 
447
504
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_debug_trace_log'>debug_trace_log</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
448
505
  <span class='id identifier rubyid_console'><span class='object_link'><a href="top-level-namespace.html#console-instance_method" title="#console (method)">console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_log'>log</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Ovto: </span><span class='tstring_end'>&quot;</span></span><span class='op'>+</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@debug_trace</span>
@@ -468,7 +525,7 @@
468
525
 
469
526
  <p>Example:</p>
470
527
 
471
- <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/api/new_task</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>POST</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>title:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>do something</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_json_data'>json_data</span><span class='op'>|</span>
528
+ <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/api/new_task</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>POST</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>title:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>do something</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_json_data'>json_data</span><span class='op'>|</span>
472
529
  <span class='id identifier rubyid_p'>p</span> <span class='id identifier rubyid_json_data'>json_data</span>
473
530
  <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_fail'>fail</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span> <span class='comment'># Network error, 404 Not Found, JSON parse error, etc.
474
531
  </span> <span class='id identifier rubyid_p'>p</span> <span class='id identifier rubyid_e'>e</span>
@@ -556,16 +613,16 @@
556
613
  <pre class="lines">
557
614
 
558
615
 
559
- 26
560
- 27
561
- 28
562
616
  29
563
617
  30
564
618
  31
565
- 32</pre>
619
+ 32
620
+ 33
621
+ 34
622
+ 35</pre>
566
623
  </td>
567
624
  <td>
568
- <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 26</span>
625
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 29</span>
569
626
 
570
627
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
571
628
  <span class='kw'>if</span> <span class='backtick'>`</span><span class='tstring_content'>obj.$inspect</span><span class='tstring_end'>`</span></span>
@@ -606,9 +663,6 @@
606
663
  <pre class="lines">
607
664
 
608
665
 
609
- 36
610
- 37
611
- 38
612
666
  39
613
667
  40
614
668
  41
@@ -627,10 +681,13 @@
627
681
  54
628
682
  55
629
683
  56
630
- 57</pre>
684
+ 57
685
+ 58
686
+ 59
687
+ 60</pre>
631
688
  </td>
632
689
  <td>
633
- <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 36</span>
690
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 39</span>
634
691
 
635
692
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_log_error'>log_error</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
636
693
  <span class='kw'>return</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
@@ -643,7 +700,7 @@
643
700
  div.textContent = &quot;ERROR: &quot; + </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ex'>ex</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'>;
644
701
  var ul = document.createElement(&#39;ul&#39;);
645
702
  // Note: ex.backtrace may be an Array or a String
646
- </span><span class='embexpr_beg'>#{</span><span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_ex'>ex</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.forEach(function(line){
703
+ </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_ex'>ex</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.forEach(function(line){
647
704
  var li = document.createElement(&#39;li&#39;);
648
705
  li.textContent = line;
649
706
  ul.appendChild(li);
@@ -657,6 +714,146 @@
657
714
  </td>
658
715
  </tr>
659
716
  </table>
717
+ </div>
718
+
719
+ <div class="method_details ">
720
+ <h3 class="signature " id="Middleware-class_method">
721
+
722
+ .<strong>Middleware</strong>(name) &#x21d2; <tt>Object</tt>
723
+
724
+
725
+
726
+
727
+
728
+ </h3><div class="docstring">
729
+ <div class="discussion">
730
+
731
+ <p>Create an ancestor of middleware class Example:</p>
732
+
733
+ <pre class="code ruby"><code class="ruby">class MiddlewareExample &lt; Ovto::Middleware(&quot;middleware_example&quot;)
734
+ </code></pre>
735
+
736
+
737
+ </div>
738
+ </div>
739
+ <div class="tags">
740
+
741
+
742
+ </div><table class="source_code">
743
+ <tr>
744
+ <td>
745
+ <pre class="lines">
746
+
747
+
748
+ 6
749
+ 7
750
+ 8
751
+ 9
752
+ 10
753
+ 11
754
+ 12
755
+ 13
756
+ 14
757
+ 15
758
+ 16
759
+ 17
760
+ 18</pre>
761
+ </td>
762
+ <td>
763
+ <pre class="code"><span class="info file"># File 'lib/ovto/middleware.rb', line 6</span>
764
+
765
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='const'>Middleware</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
766
+ <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="#VALID_NAME_REXP-constant" title="Ovto::VALID_NAME_REXP (constant)">VALID_NAME_REXP</a></span></span> <span class='op'>=~</span> <span class='id identifier rubyid_name'>name</span>
767
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid middleware name: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
768
+ <span class='kw'>end</span>
769
+ <span class='kw'>return</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware.html" title="Ovto::Middleware (module)">Middleware</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware/Base.html" title="Ovto::Middleware::Base (class)">Base</a></span></span><span class='rparen'>)</span><span class='lbrace'>{</span>
770
+ <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:OVTO_MIDDLEWARE_NAME</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
771
+ <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:State</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/State.html" title="Ovto::State (class)">State</a></span></span><span class='rparen'>)</span>
772
+ <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:Actions</span><span class='comma'>,</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware.html" title="Ovto::Middleware (module)">Middleware</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware/Actions.html" title="Ovto::Middleware::Actions (class)">Actions</a></span></span><span class='rparen'>)</span><span class='rparen'>)</span>
773
+ <span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='symbol'>:Actions</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:OVTO_MIDDLEWARE_NAME</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
774
+ <span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:Component</span><span class='comma'>,</span> <span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Ovto (module)">Ovto</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware.html" title="Ovto::Middleware (module)">Middleware</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Ovto/Middleware/Component.html" title="Ovto::Middleware::Component (class)">Component</a></span></span><span class='rparen'>)</span><span class='rparen'>)</span>
775
+ <span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='symbol'>:Component</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='symbol'>:OVTO_MIDDLEWARE_NAME</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
776
+ <span class='rbrace'>}</span>
777
+ <span class='kw'>end</span></pre>
778
+ </td>
779
+ </tr>
780
+ </table>
781
+ </div>
782
+
783
+ <div class="method_details ">
784
+ <h3 class="signature " id="send_args_with_state-class_method">
785
+
786
+ .<strong>send_args_with_state</strong>(obj, meth, args, state, &amp;block) &#x21d2; <tt>Object</tt>
787
+
788
+
789
+
790
+
791
+
792
+ </h3><div class="docstring">
793
+ <div class="discussion">
794
+
795
+ <p>Something like `obj.meth(state: state, **args, &amp;block)` Safe even if
796
+ `obj.meth` does not have `state:`</p>
797
+
798
+
799
+ </div>
800
+ </div>
801
+ <div class="tags">
802
+
803
+
804
+ </div><table class="source_code">
805
+ <tr>
806
+ <td>
807
+ <pre class="lines">
808
+
809
+
810
+ 64
811
+ 65
812
+ 66
813
+ 67
814
+ 68
815
+ 69
816
+ 70
817
+ 71
818
+ 72
819
+ 73
820
+ 74
821
+ 75
822
+ 76
823
+ 77
824
+ 78
825
+ 79
826
+ 80
827
+ 81
828
+ 82
829
+ 83</pre>
830
+ </td>
831
+ <td>
832
+ <pre class="code"><span class="info file"># File 'lib/ovto.rb', line 64</span>
833
+
834
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send_args_with_state'>send_args_with_state</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_meth'>meth</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
835
+ <span class='id identifier rubyid_parameters'>parameters</span> <span class='op'>=</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_meth'>meth</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_parameters'>parameters</span>
836
+ <span class='id identifier rubyid_accepts_state'>accepts_state</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>!parameters</span><span class='tstring_end'>`</span></span> <span class='op'>||</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
837
+ <span class='id identifier rubyid_item'>item</span> <span class='op'>==</span> <span class='lbracket'>[</span><span class='symbol'>:key</span><span class='comma'>,</span> <span class='symbol'>:state</span><span class='rbracket'>]</span> <span class='op'>||</span>
838
+ <span class='id identifier rubyid_item'>item</span> <span class='op'>==</span> <span class='lbracket'>[</span><span class='symbol'>:keyreq</span><span class='comma'>,</span> <span class='symbol'>:state</span><span class='rbracket'>]</span> <span class='op'>||</span>
839
+ <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:keyrest</span>
840
+ <span class='rbrace'>}</span>
841
+ <span class='kw'>if</span> <span class='id identifier rubyid_accepts_state'>accepts_state</span>
842
+ <span class='comment'># We can pass `state:` safely
843
+ </span> <span class='id identifier rubyid_args_with_state'>args_with_state</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
844
+ <span class='kw'>return</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_meth'>meth</span><span class='comma'>,</span> <span class='id identifier rubyid_args_with_state'>args_with_state</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
845
+ <span class='kw'>else</span>
846
+ <span class='comment'># Check it is empty (see https://github.com/opal/opal/issues/1872)
847
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
848
+ <span class='kw'>return</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_meth'>meth</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
849
+ <span class='kw'>else</span>
850
+ <span class='kw'>return</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid___send__'>__send__</span><span class='lparen'>(</span><span class='id identifier rubyid_meth'>meth</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
851
+ <span class='kw'>end</span>
852
+ <span class='kw'>end</span>
853
+ <span class='kw'>end</span></pre>
854
+ </td>
855
+ </tr>
856
+ </table>
660
857
  </div>
661
858
 
662
859
  </div>
@@ -664,9 +861,9 @@
664
861
  </div>
665
862
 
666
863
  <div id="footer">
667
- Generated on Fri Apr 19 12:51:39 2019 by
864
+ Generated on Sat Feb 29 23:26:32 2020 by
668
865
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
669
- 0.9.19 (ruby-2.5.5).
866
+ 0.9.24 (ruby-2.5.5).
670
867
  </div>
671
868
 
672
869
  </div>