ruff 1.3.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +1 -1
  4. data/Gemfile +3 -0
  5. data/README.md +35 -58
  6. data/Rakefile +2 -1
  7. data/docs/.nojekyll +0 -0
  8. data/docs/Ruff.html +7 -7
  9. data/docs/Ruff/Effect.html +165 -23
  10. data/docs/Ruff/Handler.html +46 -114
  11. data/docs/Ruff/Standard.html +7 -7
  12. data/docs/Ruff/Standard/Async.html +28 -27
  13. data/docs/Ruff/Standard/Async/Instance.html +63 -27
  14. data/docs/Ruff/Standard/Call1cc.html +297 -0
  15. data/docs/Ruff/Standard/CurrentTime.html +6 -6
  16. data/docs/Ruff/Standard/CurrentTime/Instance.html +7 -7
  17. data/docs/Ruff/Standard/Defer.html +6 -6
  18. data/docs/Ruff/Standard/Defer/Instance.html +6 -6
  19. data/docs/Ruff/Standard/DelimCtrl.html +340 -0
  20. data/docs/Ruff/Standard/MeasureTime.html +6 -6
  21. data/docs/Ruff/Standard/MeasureTime/Instance.html +8 -8
  22. data/docs/Ruff/Standard/State.html +6 -6
  23. data/docs/Ruff/Standard/State/Instance.html +6 -6
  24. data/docs/Ruff/Throws.html +6 -11
  25. data/docs/Ruff/Throws/Eff.html +6 -6
  26. data/docs/Ruff/Throws/Resend.html +6 -6
  27. data/docs/_index.html +14 -7
  28. data/docs/class_list.html +3 -3
  29. data/docs/css/style.css +2 -2
  30. data/docs/file.README.html +41 -58
  31. data/docs/file_list.html +2 -2
  32. data/docs/frames.html +2 -2
  33. data/docs/index.html +41 -58
  34. data/docs/js/app.js +14 -3
  35. data/docs/method_list.html +46 -30
  36. data/docs/top-level-namespace.html +6 -6
  37. data/lib/ruff/effect.rb +32 -3
  38. data/lib/ruff/handler.rb +43 -18
  39. data/lib/ruff/standard.rb +1 -0
  40. data/lib/ruff/standard/async.rb +27 -22
  41. data/lib/ruff/standard/current_time.rb +1 -1
  42. data/lib/ruff/standard/delim_ctrl.rb +49 -0
  43. data/lib/ruff/standard/measure_time.rb +2 -2
  44. data/lib/ruff/version.rb +1 -1
  45. data/ruff.gemspec +1 -1
  46. data/version +1 -1
  47. metadata +12 -9
  48. data/Gemfile.lock +0 -62
@@ -0,0 +1,297 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Ruff::Standard::Call1cc
8
+
9
+ &mdash; Ruff 2.0.1 Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Ruff::Standard::Call1cc";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Standard.html" title="Ruff::Standard (module)">Standard</a></span></span>
41
+ &raquo;
42
+ <span class="title">Call1cc</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Ruff::Standard::Call1cc
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/ruff/standard/call1cc.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+ <p><code>Call1cc</code> provides call-with-oneshot-continuation.
89
+ The continuation can be run in the <code>context</code>.</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+ <div class="examples">
97
+ <p class="tag_title">Examples:</p>
98
+
99
+
100
+ <pre class="example code"><code><span class='const'>Call1cc</span><span class='period'>.</span><span class='id identifier rubyid_context'><span class='object_link'><a href="#context-class_method" title="Ruff::Standard::Call1cc.context (method)">context</a></span></span> <span class='kw'>do</span>
101
+ <span class='id identifier rubyid_divfail'>divfail</span> <span class='op'>=</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='op'>|</span>
102
+ <span class='const'>Call1cc</span><span class='period'>.</span><span class='id identifier rubyid_run'><span class='object_link'><a href="#run-class_method" title="Ruff::Standard::Call1cc.run (method)">run</a></span></span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span>
103
+ <span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
104
+ <span class='kw'>if</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
105
+ <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_default'>default</span><span class='rparen'>)</span>
106
+ <span class='kw'>else</span>
107
+ <span class='id identifier rubyid_e'>e</span> <span class='op'>/</span> <span class='int'>2</span>
108
+ <span class='kw'>end</span>
109
+ <span class='rbrace'>}</span>
110
+ <span class='rbrace'>}</span>
111
+ <span class='rbrace'>}</span>
112
+
113
+ <span class='id identifier rubyid_pp'>pp</span> <span class='id identifier rubyid_divfail'>divfail</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
114
+ <span class='comment'># ==&gt; [0, 1, 2]
115
+ </span> <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>---</span><span class='tstring_end'>&#39;</span></span>
116
+ <span class='id identifier rubyid_pp'>pp</span> <span class='id identifier rubyid_divfail'>divfail</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
117
+ <span class='comment'># ==&gt; [1]
118
+ </span><span class='kw'>end</span></code></pre>
119
+
120
+ </div>
121
+
122
+
123
+ </div>
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <h2>
132
+ Class Method Summary
133
+ <small><a href="#" class="summary_toggle">collapse</a></small>
134
+ </h2>
135
+
136
+ <ul class="summary">
137
+
138
+ <li class="public ">
139
+ <span class="summary_signature">
140
+
141
+ <a href="#context-class_method" title="context (class method)">.<strong>context</strong>(&amp;prc) &#x21d2; Object </a>
142
+
143
+
144
+
145
+ </span>
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <span class="summary_desc"><div class='inline'></div></span>
156
+
157
+ </li>
158
+
159
+
160
+ <li class="public ">
161
+ <span class="summary_signature">
162
+
163
+ <a href="#run-class_method" title="run (class method)">.<strong>run</strong>(&amp;f) &#x21d2; Object </a>
164
+
165
+
166
+
167
+ </span>
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+ <span class="summary_desc"><div class='inline'></div></span>
178
+
179
+ </li>
180
+
181
+
182
+ </ul>
183
+
184
+
185
+
186
+
187
+ <div id="class_method_details" class="method_details_list">
188
+ <h2>Class Method Details</h2>
189
+
190
+
191
+ <div class="method_details first">
192
+ <h3 class="signature first" id="context-class_method">
193
+
194
+ .<strong>context</strong>(&amp;prc) &#x21d2; <tt>Object</tt>
195
+
196
+
197
+
198
+
199
+
200
+ </h3><table class="source_code">
201
+ <tr>
202
+ <td>
203
+ <pre class="lines">
204
+
205
+
206
+ 31
207
+ 32
208
+ 33
209
+ 34
210
+ 35
211
+ 36
212
+ 37
213
+ 38
214
+ 39
215
+ 40
216
+ 41
217
+ 42
218
+ 43</pre>
219
+ </td>
220
+ <td>
221
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/call1cc.rb', line 31</span>
222
+
223
+ <span class='kw'>def</span> <span class='id identifier rubyid_context'>context</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_prc'>prc</span><span class='rparen'>)</span>
224
+ <span class='id identifier rubyid_p'>p</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_instance'><span class='object_link'><a href="../../Ruff.html#instance-class_method" title="Ruff.instance (method)">instance</a></span></span>
225
+ <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_p'>p</span>
226
+
227
+ <span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_handler'><span class='object_link'><a href="../../Ruff.html#handler-class_method" title="Ruff.handler (method)">handler</a></span></span>
228
+ <span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
229
+ <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
230
+ <span class='kw'>end</span>
231
+ <span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_prc'>prc</span><span class='rparen'>)</span>
232
+
233
+ <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
234
+ <span class='id identifier rubyid_ret'>ret</span>
235
+ <span class='kw'>end</span></pre>
236
+ </td>
237
+ </tr>
238
+ </table>
239
+ </div>
240
+
241
+ <div class="method_details ">
242
+ <h3 class="signature " id="run-class_method">
243
+
244
+ .<strong>run</strong>(&amp;f) &#x21d2; <tt>Object</tt>
245
+
246
+
247
+
248
+
249
+
250
+ </h3><table class="source_code">
251
+ <tr>
252
+ <td>
253
+ <pre class="lines">
254
+
255
+
256
+ 45
257
+ 46
258
+ 47
259
+ 48
260
+ 49
261
+ 50
262
+ 51
263
+ 52
264
+ 53
265
+ 54</pre>
266
+ </td>
267
+ <td>
268
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/call1cc.rb', line 45</span>
269
+
270
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span>
271
+ <span class='id identifier rubyid_top'>top</span> <span class='op'>=</span> <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
272
+ <span class='const'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_handler'><span class='object_link'><a href="../../Ruff.html#handler-class_method" title="Ruff.handler (method)">handler</a></span></span>
273
+ <span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='id identifier rubyid_top'>top</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
274
+ <span class='comment'># abort the rest of computation from calling the continuation
275
+ </span> <span class='id identifier rubyid_top'>top</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
276
+ <span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>do</span>
277
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_top'>top</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
278
+ <span class='kw'>end</span>
279
+ <span class='kw'>end</span></pre>
280
+ </td>
281
+ </tr>
282
+ </table>
283
+ </div>
284
+
285
+ </div>
286
+
287
+ </div>
288
+
289
+ <div id="footer">
290
+ Generated on Wed Jun 10 21:13:53 2020 by
291
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
292
+ 0.9.25 (ruby-2.7.1).
293
+ </div>
294
+
295
+ </div>
296
+ </body>
297
+ </html>
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Module: Ruff::Standard::CurrentTime
8
8
 
9
- &mdash; Ruff 1.3.0 Documentation
9
+ &mdash; Ruff 2.1.0 Documentation
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 = "Ruff::Standard::CurrentTime";
19
19
  relpath = '../../';
20
20
  </script>
@@ -362,9 +362,9 @@
362
362
  </div>
363
363
 
364
364
  <div id="footer">
365
- Generated on Sun Oct 6 23:09:11 2019 by
365
+ Generated on Wed Jun 10 21:24:09 2020 by
366
366
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
367
- 0.9.20 (ruby-2.6.5).
367
+ 0.9.25 (ruby-2.7.1).
368
368
  </div>
369
369
 
370
370
  </div>
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Class: Ruff::Standard::CurrentTime::Instance
8
8
 
9
- &mdash; Ruff 1.3.0 Documentation
9
+ &mdash; Ruff 2.1.0 Documentation
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 = "Ruff::Standard::CurrentTime::Instance";
19
19
  relpath = '../../../';
20
20
  </script>
@@ -449,7 +449,7 @@ But it still has the possibility to invoke effects(e).

449
449
  <pre class="code"><span class="info file"># File 'lib/ruff/standard/current_time.rb', line 32</span>
450
450
 
451
451
  <span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
452
- <span class='ivar'>@handler</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
452
+ <span class='ivar'>@handler</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
453
453
  <span class='kw'>end</span></pre>
454
454
  </td>
455
455
  </tr>
@@ -461,9 +461,9 @@ But it still has the possibility to invoke effects(e).

461
461
  </div>
462
462
 
463
463
  <div id="footer">
464
- Generated on Sun Oct 6 23:09:11 2019 by
464
+ Generated on Wed Jun 10 21:24:09 2020 by
465
465
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
466
- 0.9.20 (ruby-2.6.5).
466
+ 0.9.25 (ruby-2.7.1).
467
467
  </div>
468
468
 
469
469
  </div>
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Module: Ruff::Standard::Defer
8
8
 
9
- &mdash; Ruff 1.3.0 Documentation
9
+ &mdash; Ruff 2.1.0 Documentation
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 = "Ruff::Standard::Defer";
19
19
  relpath = '../../';
20
20
  </script>
@@ -363,9 +363,9 @@ and the implementation to defer procedures .

363
363
  </div>
364
364
 
365
365
  <div id="footer">
366
- Generated on Sun Oct 6 23:09:11 2019 by
366
+ Generated on Wed Jun 10 21:24:09 2020 by
367
367
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
368
- 0.9.20 (ruby-2.6.5).
368
+ 0.9.25 (ruby-2.7.1).
369
369
  </div>
370
370
 
371
371
  </div>
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Class: Ruff::Standard::Defer::Instance
8
8
 
9
- &mdash; Ruff 1.3.0 Documentation
9
+ &mdash; Ruff 2.1.0 Documentation
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 = "Ruff::Standard::Defer::Instance";
19
19
  relpath = '../../../';
20
20
  </script>
@@ -503,9 +503,9 @@ But it still has the possibility to invoke effects(e).

503
503
  </div>
504
504
 
505
505
  <div id="footer">
506
- Generated on Sun Oct 6 23:09:11 2019 by
506
+ Generated on Wed Jun 10 21:24:10 2020 by
507
507
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
508
- 0.9.20 (ruby-2.6.5).
508
+ 0.9.25 (ruby-2.7.1).
509
509
  </div>
510
510
 
511
511
  </div>
@@ -0,0 +1,340 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Ruff::Standard::DelimCtrl
8
+
9
+ &mdash; Ruff 2.1.0 Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Ruff::Standard::DelimCtrl";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (D)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Standard.html" title="Ruff::Standard (module)">Standard</a></span></span>
41
+ &raquo;
42
+ <span class="title">DelimCtrl</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Ruff::Standard::DelimCtrl
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/ruff/standard/delim_ctrl.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Overview</h2><div class="docstring">
87
+ <div class="discussion">
88
+ <p><code>DelimCtrl</code> provides one-shot delimited control operators, <code>shift</code> and <code>reset</code>.</p>
89
+
90
+
91
+ </div>
92
+ </div>
93
+ <div class="tags">
94
+
95
+ <div class="examples">
96
+ <p class="tag_title">Examples:</p>
97
+
98
+
99
+ <pre class="example code"><code><span class='const'>DelimCtrl</span><span class='period'>.</span><span class='id identifier rubyid_reset'><span class='object_link'><a href="#reset-class_method" title="Ruff::Standard::DelimCtrl.reset (method)">reset</a></span></span> <span class='lbrace'>{</span>
100
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hello</span><span class='tstring_end'>&quot;</span></span>
101
+ <span class='const'>DelimCtrl</span><span class='period'>.</span><span class='id identifier rubyid_shift'><span class='object_link'><a href="#shift-class_method" title="Ruff::Standard::DelimCtrl.shift (method)">shift</a></span></span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span>
102
+ <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
103
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>!</span><span class='tstring_end'>&quot;</span></span>
104
+ <span class='rbrace'>}</span>
105
+
106
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>world</span><span class='tstring_end'>&quot;</span></span>
107
+ <span class='rbrace'>}</span>
108
+ <span class='comment'># ==&gt;
109
+ </span><span class='comment'># hello
110
+ </span><span class='comment'># world
111
+ </span><span class='comment'># !</span></code></pre>
112
+
113
+ </div>
114
+
115
+
116
+ </div>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <h2>
125
+ Class Method Summary
126
+ <small><a href="#" class="summary_toggle">collapse</a></small>
127
+ </h2>
128
+
129
+ <ul class="summary">
130
+
131
+ <li class="public ">
132
+ <span class="summary_signature">
133
+
134
+ <a href="#reset-class_method" title="reset (class method)">.<strong>reset</strong>(&amp;th) &#x21d2; Object </a>
135
+
136
+
137
+
138
+ </span>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="summary_desc"><div class='inline'><p>delimits a continuation.</p>
149
+ </div></span>
150
+
151
+ </li>
152
+
153
+
154
+ <li class="public ">
155
+ <span class="summary_signature">
156
+
157
+ <a href="#shift-class_method" title="shift (class method)">.<strong>shift</strong>(&amp;k) &#x21d2; Object </a>
158
+
159
+
160
+
161
+ </span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'><p>captures a continuation.</p>
172
+ </div></span>
173
+
174
+ </li>
175
+
176
+
177
+ </ul>
178
+
179
+
180
+
181
+
182
+ <div id="class_method_details" class="method_details_list">
183
+ <h2>Class Method Details</h2>
184
+
185
+
186
+ <div class="method_details first">
187
+ <h3 class="signature first" id="reset-class_method">
188
+
189
+ .<strong>reset</strong>(&amp;th) &#x21d2; <tt>Object</tt>
190
+
191
+
192
+
193
+
194
+
195
+ </h3><div class="docstring">
196
+ <div class="discussion">
197
+ <p>delimits a continuation</p>
198
+
199
+
200
+ </div>
201
+ </div>
202
+ <div class="tags">
203
+ <p class="tag_title">Parameters:</p>
204
+ <ul class="param">
205
+
206
+ <li>
207
+
208
+ <span class='name'>th</span>
209
+
210
+
211
+ <span class='type'>(<tt>Proc&lt;(), A&gt;</tt>)</span>
212
+
213
+
214
+
215
+ &mdash;
216
+ <div class='inline'><p>is a thunk. In this thunk <code>shift</code> captures a continuation delimited with the thunk.</p>
217
+ </div>
218
+
219
+ </li>
220
+
221
+ </ul>
222
+
223
+
224
+ </div><table class="source_code">
225
+ <tr>
226
+ <td>
227
+ <pre class="lines">
228
+
229
+
230
+ 25
231
+ 26
232
+ 27
233
+ 28
234
+ 29
235
+ 30
236
+ 31
237
+ 32
238
+ 33
239
+ 34
240
+ 35
241
+ 36
242
+ 37</pre>
243
+ </td>
244
+ <td>
245
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/delim_ctrl.rb', line 25</span>
246
+
247
+ <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
248
+ <span class='id identifier rubyid_eff'>eff</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Effect.html" title="Ruff::Effect (class)">Effect</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Effect.html#initialize-instance_method" title="Ruff::Effect#initialize (method)">new</a></span></span>
249
+ <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_eff'>eff</span>
250
+
251
+ <span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_handler'><span class='object_link'><a href="../../Ruff.html#handler-class_method" title="Ruff.handler (method)">handler</a></span></span>
252
+ <span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='id identifier rubyid_eff'>eff</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
253
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
254
+ <span class='kw'>end</span>
255
+ <span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
256
+
257
+ <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
258
+ <span class='id identifier rubyid_ret'>ret</span>
259
+ <span class='kw'>end</span></pre>
260
+ </td>
261
+ </tr>
262
+ </table>
263
+ </div>
264
+
265
+ <div class="method_details ">
266
+ <h3 class="signature " id="shift-class_method">
267
+
268
+ .<strong>shift</strong>(&amp;k) &#x21d2; <tt>Object</tt>
269
+
270
+
271
+
272
+
273
+
274
+ </h3><div class="docstring">
275
+ <div class="discussion">
276
+ <p>captures a continuation.</p>
277
+
278
+
279
+ </div>
280
+ </div>
281
+ <div class="tags">
282
+ <p class="tag_title">Parameters:</p>
283
+ <ul class="param">
284
+
285
+ <li>
286
+
287
+ <span class='name'>k</span>
288
+
289
+
290
+ <span class='type'>(<tt>Proc&lt;Proc&lt;C, A&gt;, A/B&gt;</tt>)</span>
291
+
292
+
293
+
294
+ &mdash;
295
+ <div class='inline'><p>is a continuation.</p>
296
+ </div>
297
+
298
+ </li>
299
+
300
+ </ul>
301
+
302
+
303
+ </div><table class="source_code">
304
+ <tr>
305
+ <td>
306
+ <pre class="lines">
307
+
308
+
309
+ 42
310
+ 43
311
+ 44
312
+ 45
313
+ 46</pre>
314
+ </td>
315
+ <td>
316
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/delim_ctrl.rb', line 42</span>
317
+
318
+ <span class='kw'>def</span> <span class='id identifier rubyid_shift'>shift</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
319
+ <span class='comment'># fetch nearmost prompt
320
+ </span> <span class='id identifier rubyid_top'>top</span> <span class='op'>=</span> <span class='ivar'>@stack</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
321
+ <span class='id identifier rubyid_top'>top</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
322
+ <span class='kw'>end</span></pre>
323
+ </td>
324
+ </tr>
325
+ </table>
326
+ </div>
327
+
328
+ </div>
329
+
330
+ </div>
331
+
332
+ <div id="footer">
333
+ Generated on Wed Jun 10 21:24:09 2020 by
334
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
335
+ 0.9.25 (ruby-2.7.1).
336
+ </div>
337
+
338
+ </div>
339
+ </body>
340
+ </html>