ruff 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +3 -0
- data/docs/Ruff.html +5 -5
- data/docs/Ruff/Effect.html +3 -3
- data/docs/Ruff/Handler.html +19 -8
- data/docs/Ruff/Standard.html +4 -4
- data/docs/Ruff/Standard/CurrentTime.html +12 -12
- data/docs/Ruff/Standard/CurrentTime/Instance.html +17 -15
- data/docs/Ruff/Standard/Defer.html +15 -15
- data/docs/Ruff/Standard/Defer/Instance.html +16 -10
- data/docs/Ruff/Standard/MeasureTime.html +389 -0
- data/docs/Ruff/Standard/MeasureTime/Instance.html +499 -0
- data/docs/Ruff/Standard/State.html +49 -27
- data/docs/Ruff/Standard/State/Instance.html +49 -47
- data/docs/Ruff/Throws.html +3 -3
- data/docs/Ruff/Throws/Eff.html +3 -3
- data/docs/Ruff/Throws/Resend.html +3 -3
- data/docs/_index.html +29 -7
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +3 -3
- data/docs/frames.html +1 -1
- data/docs/index.html +3 -3
- data/docs/method_list.html +74 -18
- data/docs/top-level-namespace.html +3 -3
- data/lib/ruff.rb +1 -1
- data/lib/ruff/standard.rb +2 -0
- data/lib/ruff/standard/current_time.rb +3 -2
- data/lib/ruff/standard/defer.rb +4 -1
- data/lib/ruff/standard/measure_time.rb +77 -0
- data/lib/ruff/standard/state.rb +17 -0
- data/lib/ruff/version.rb +1 -1
- data/version +1 -1
- metadata +4 -1
@@ -0,0 +1,389 @@
|
|
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::MeasureTime
|
8
|
+
|
9
|
+
— Ruff 1.1.0 Documentation
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Ruff::Standard::MeasureTime";
|
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 (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Ruff.html" title="Ruff (module)">Ruff</a></span></span> » <span class='title'><span class='object_link'><a href="../Standard.html" title="Ruff::Standard (module)">Standard</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MeasureTime</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::MeasureTime
|
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/measure_time.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
<p><code>MeasureTime</code> provides effects <code>MeasureTime.eff</code> ,
|
89
|
+
and the implementation to measure and report execution time .</p>
|
90
|
+
|
91
|
+
<p>The module has an instance of <code>Instance</code> and provides its methods as module method.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
<div class="examples">
|
99
|
+
<p class="tag_title">Examples:</p>
|
100
|
+
|
101
|
+
|
102
|
+
<pre class="example code"><code><span class='const'>MeasureTime</span><span class='period'>.</span><span class='id identifier rubyid_with'><span class='object_link'><a href="#with-class_method" title="Ruff::Standard::MeasureTime.with (method)">with</a></span></span> <span class='lbrace'>{</span>
|
103
|
+
<span class='const'>MeasureTime</span><span class='period'>.</span><span class='id identifier rubyid_measure'><span class='object_link'><a href="#measure-class_method" title="Ruff::Standard::MeasureTime.measure (method)">measure</a></span></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>one</span><span class='tstring_end'>'</span></span>
|
104
|
+
<span class='id identifier rubyid_sleep'>sleep</span> <span class='int'>1</span>
|
105
|
+
<span class='const'>MeasureTime</span><span class='period'>.</span><span class='id identifier rubyid_measure'><span class='object_link'><a href="#measure-class_method" title="Ruff::Standard::MeasureTime.measure (method)">measure</a></span></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>two</span><span class='tstring_end'>'</span></span>
|
106
|
+
<span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.1</span>
|
107
|
+
|
108
|
+
<span class='kw'>return</span> <span class='int'>0</span>
|
109
|
+
<span class='rbrace'>}</span>
|
110
|
+
<span class='comment'>#==> [0, {:label=>"two", :time=>0.1}, {:label=>"one", :time=>1.1}]</span></code></pre>
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
<p class="tag_title">See Also:</p>
|
116
|
+
<ul class="see">
|
117
|
+
|
118
|
+
<li><span class='object_link'><a href="MeasureTime/Instance.html" title="Ruff::Standard::MeasureTime::Instance (class)">Instance</a></span></li>
|
119
|
+
|
120
|
+
</ul>
|
121
|
+
|
122
|
+
</div><h2>Defined Under Namespace</h2>
|
123
|
+
<p class="children">
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="MeasureTime/Instance.html" title="Ruff::Standard::MeasureTime::Instance (class)">Instance</a></span>
|
129
|
+
|
130
|
+
|
131
|
+
</p>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
137
|
+
<ul class="summary">
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#eff-instance_method" title="#eff (instance method)">#<strong>eff</strong> ⇒ Object </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<span class="note title readonly">readonly</span>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
162
|
+
|
163
|
+
</li>
|
164
|
+
|
165
|
+
|
166
|
+
</ul>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<h2>
|
173
|
+
Class Method Summary
|
174
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
175
|
+
</h2>
|
176
|
+
|
177
|
+
<ul class="summary">
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#measure-class_method" title="measure (class method)">.<strong>measure</strong>(label) ⇒ Object </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#with-class_method" title="with (class method)">.<strong>with</strong>(&th) ⇒ Object </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
</ul>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
<div id="instance_attr_details" class="attr_details">
|
228
|
+
<h2>Instance Attribute Details</h2>
|
229
|
+
|
230
|
+
|
231
|
+
<span id=""></span>
|
232
|
+
<div class="method_details first">
|
233
|
+
<h3 class="signature first" id="eff-instance_method">
|
234
|
+
|
235
|
+
#<strong>eff</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
</h3><div class="docstring">
|
242
|
+
<div class="discussion">
|
243
|
+
|
244
|
+
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
<div class="tags">
|
248
|
+
|
249
|
+
|
250
|
+
<p class="tag_title">See Also:</p>
|
251
|
+
<ul class="see">
|
252
|
+
|
253
|
+
<li><span class='object_link'><a href="MeasureTime/Instance.html#eff-instance_method" title="Ruff::Standard::MeasureTime::Instance#eff (method)">Ruff::Standard::MeasureTime::Instance#eff</a></span></li>
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
</div><table class="source_code">
|
258
|
+
<tr>
|
259
|
+
<td>
|
260
|
+
<pre class="lines">
|
261
|
+
|
262
|
+
|
263
|
+
76
|
264
|
+
77
|
265
|
+
78</pre>
|
266
|
+
</td>
|
267
|
+
<td>
|
268
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 76</span>
|
269
|
+
|
270
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_eff'>eff</span>
|
271
|
+
<span class='ivar'>@eff</span>
|
272
|
+
<span class='kw'>end</span></pre>
|
273
|
+
</td>
|
274
|
+
</tr>
|
275
|
+
</table>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div id="class_method_details" class="method_details_list">
|
282
|
+
<h2>Class Method Details</h2>
|
283
|
+
|
284
|
+
|
285
|
+
<div class="method_details first">
|
286
|
+
<h3 class="signature first" id="measure-class_method">
|
287
|
+
|
288
|
+
.<strong>measure</strong>(label) ⇒ <tt>Object</tt>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</h3><div class="docstring">
|
295
|
+
<div class="discussion">
|
296
|
+
|
297
|
+
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
<div class="tags">
|
301
|
+
|
302
|
+
|
303
|
+
<p class="tag_title">See Also:</p>
|
304
|
+
<ul class="see">
|
305
|
+
|
306
|
+
<li><span class='object_link'><a href="MeasureTime/Instance.html#measure-instance_method" title="Ruff::Standard::MeasureTime::Instance#measure (method)">Ruff::Standard::MeasureTime::Instance#measure</a></span></li>
|
307
|
+
|
308
|
+
</ul>
|
309
|
+
|
310
|
+
</div><table class="source_code">
|
311
|
+
<tr>
|
312
|
+
<td>
|
313
|
+
<pre class="lines">
|
314
|
+
|
315
|
+
|
316
|
+
64
|
317
|
+
65
|
318
|
+
66</pre>
|
319
|
+
</td>
|
320
|
+
<td>
|
321
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 64</span>
|
322
|
+
|
323
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_measure'>measure</span><span class='lparen'>(</span><span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
324
|
+
<span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_measure'>measure</span><span class='lparen'>(</span><span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
325
|
+
<span class='kw'>end</span></pre>
|
326
|
+
</td>
|
327
|
+
</tr>
|
328
|
+
</table>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div class="method_details ">
|
332
|
+
<h3 class="signature " id="with-class_method">
|
333
|
+
|
334
|
+
.<strong>with</strong>(&th) ⇒ <tt>Object</tt>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
</h3><div class="docstring">
|
341
|
+
<div class="discussion">
|
342
|
+
|
343
|
+
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
<div class="tags">
|
347
|
+
|
348
|
+
|
349
|
+
<p class="tag_title">See Also:</p>
|
350
|
+
<ul class="see">
|
351
|
+
|
352
|
+
<li><span class='object_link'><a href="MeasureTime/Instance.html#with-instance_method" title="Ruff::Standard::MeasureTime::Instance#with (method)">Ruff::Standard::MeasureTime::Instance#with</a></span></li>
|
353
|
+
|
354
|
+
</ul>
|
355
|
+
|
356
|
+
</div><table class="source_code">
|
357
|
+
<tr>
|
358
|
+
<td>
|
359
|
+
<pre class="lines">
|
360
|
+
|
361
|
+
|
362
|
+
69
|
363
|
+
70
|
364
|
+
71</pre>
|
365
|
+
</td>
|
366
|
+
<td>
|
367
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 69</span>
|
368
|
+
|
369
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
|
370
|
+
<span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
|
371
|
+
<span class='kw'>end</span></pre>
|
372
|
+
</td>
|
373
|
+
</tr>
|
374
|
+
</table>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
</div>
|
378
|
+
|
379
|
+
</div>
|
380
|
+
|
381
|
+
<div id="footer">
|
382
|
+
Generated on Fri Oct 4 21:12:21 2019 by
|
383
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
384
|
+
0.9.20 (ruby-2.6.5).
|
385
|
+
</div>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
</body>
|
389
|
+
</html>
|
@@ -0,0 +1,499 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Ruff::Standard::MeasureTime::Instance
|
8
|
+
|
9
|
+
— Ruff 1.1.0 Documentation
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Ruff::Standard::MeasureTime::Instance";
|
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 (I)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../Ruff.html" title="Ruff (module)">Ruff</a></span></span> » <span class='title'><span class='object_link'><a href="../../Standard.html" title="Ruff::Standard (module)">Standard</a></span></span> » <span class='title'><span class='object_link'><a href="../MeasureTime.html" title="Ruff::Standard::MeasureTime (module)">MeasureTime</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Instance</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Ruff::Standard::MeasureTime::Instance
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Ruff::Standard::MeasureTime::Instance</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/ruff/standard/measure_time.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
107
|
+
<ul class="summary">
|
108
|
+
|
109
|
+
<li class="public ">
|
110
|
+
<span class="summary_signature">
|
111
|
+
|
112
|
+
<a href="#eff-instance_method" title="#eff (instance method)">#<strong>eff</strong> ⇒ Object </a>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</span>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<span class="note title readonly">readonly</span>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<span class="summary_desc"><div class='inline'><p>You can reimplement the handler using this effect instance.</p>
|
132
|
+
</div></span>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
</ul>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<h2>
|
144
|
+
Instance Method Summary
|
145
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
146
|
+
</h2>
|
147
|
+
|
148
|
+
<ul class="summary">
|
149
|
+
|
150
|
+
<li class="public ">
|
151
|
+
<span class="summary_signature">
|
152
|
+
|
153
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Instance </a>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</span>
|
158
|
+
|
159
|
+
|
160
|
+
<span class="note title constructor">constructor</span>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<span class="summary_desc"><div class='inline'><p>makes a new instance.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#measure-instance_method" title="#measure (instance method)">#<strong>measure</strong>(label) ⇒ () </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'><p>is a smart method to invoke the effect operation.</p>
|
193
|
+
</div></span>
|
194
|
+
|
195
|
+
</li>
|
196
|
+
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#with-instance_method" title="#with (instance method)">#<strong>with</strong>(&th) ⇒ [A, ...{ label: string, time: float }]!{e} </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'><p>is a handler to interpret the effect invocation as measuring computation time.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
<div id="constructor_details" class="method_details_list">
|
225
|
+
<h2>Constructor Details</h2>
|
226
|
+
|
227
|
+
<div class="method_details first">
|
228
|
+
<h3 class="signature first" id="initialize-instance_method">
|
229
|
+
|
230
|
+
#<strong>initialize</strong> ⇒ <tt><span class='object_link'><a href="" title="Ruff::Standard::MeasureTime::Instance (class)">Instance</a></span></tt>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</h3><div class="docstring">
|
237
|
+
<div class="discussion">
|
238
|
+
<p>makes a new instance.</p>
|
239
|
+
|
240
|
+
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
<div class="tags">
|
244
|
+
|
245
|
+
|
246
|
+
</div><table class="source_code">
|
247
|
+
<tr>
|
248
|
+
<td>
|
249
|
+
<pre class="lines">
|
250
|
+
|
251
|
+
|
252
|
+
22
|
253
|
+
23
|
254
|
+
24
|
255
|
+
25
|
256
|
+
26
|
257
|
+
27
|
258
|
+
28
|
259
|
+
29
|
260
|
+
30
|
261
|
+
31
|
262
|
+
32</pre>
|
263
|
+
</td>
|
264
|
+
<td>
|
265
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 22</span>
|
266
|
+
|
267
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
268
|
+
<span class='ivar'>@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='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>
|
269
|
+
<span class='ivar'>@handler</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>
|
270
|
+
<span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='ivar'>@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_label'>label</span><span class='op'>|</span>
|
271
|
+
<span class='id identifier rubyid_t1'>t1</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
272
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
|
273
|
+
<span class='id identifier rubyid_t2'>t2</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
274
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='lbrace'>{</span> <span class='label'>label:</span> <span class='id identifier rubyid_label'>label</span><span class='comma'>,</span> <span class='label'>time:</span> <span class='id identifier rubyid_t2'>t2</span> <span class='op'>-</span> <span class='id identifier rubyid_t1'>t1</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
|
275
|
+
<span class='kw'>end</span>
|
276
|
+
<span class='period'>.</span><span class='id identifier rubyid_to'>to</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
277
|
+
<span class='kw'>end</span></pre>
|
278
|
+
</td>
|
279
|
+
</tr>
|
280
|
+
</table>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div id="instance_attr_details" class="attr_details">
|
286
|
+
<h2>Instance Attribute Details</h2>
|
287
|
+
|
288
|
+
|
289
|
+
<span id=""></span>
|
290
|
+
<div class="method_details first">
|
291
|
+
<h3 class="signature first" id="eff-instance_method">
|
292
|
+
|
293
|
+
#<strong>eff</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</h3><div class="docstring">
|
300
|
+
<div class="discussion">
|
301
|
+
<p>You can reimplement the handler using this effect instance.</p>
|
302
|
+
|
303
|
+
|
304
|
+
</div>
|
305
|
+
</div>
|
306
|
+
<div class="tags">
|
307
|
+
|
308
|
+
|
309
|
+
</div><table class="source_code">
|
310
|
+
<tr>
|
311
|
+
<td>
|
312
|
+
<pre class="lines">
|
313
|
+
|
314
|
+
|
315
|
+
56
|
316
|
+
57
|
317
|
+
58</pre>
|
318
|
+
</td>
|
319
|
+
<td>
|
320
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 56</span>
|
321
|
+
|
322
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_eff'>eff</span>
|
323
|
+
<span class='ivar'>@eff</span>
|
324
|
+
<span class='kw'>end</span></pre>
|
325
|
+
</td>
|
326
|
+
</tr>
|
327
|
+
</table>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
</div>
|
331
|
+
|
332
|
+
|
333
|
+
<div id="instance_method_details" class="method_details_list">
|
334
|
+
<h2>Instance Method Details</h2>
|
335
|
+
|
336
|
+
|
337
|
+
<div class="method_details first">
|
338
|
+
<h3 class="signature first" id="measure-instance_method">
|
339
|
+
|
340
|
+
#<strong>measure</strong>(label) ⇒ <tt>()</tt>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
</h3><div class="docstring">
|
347
|
+
<div class="discussion">
|
348
|
+
<p>is a smart method to invoke the effect operation.</p>
|
349
|
+
|
350
|
+
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
<div class="tags">
|
354
|
+
<p class="tag_title">Parameters:</p>
|
355
|
+
<ul class="param">
|
356
|
+
|
357
|
+
<li>
|
358
|
+
|
359
|
+
<span class='name'>label</span>
|
360
|
+
|
361
|
+
|
362
|
+
<span class='type'>(<tt>string</tt>)</span>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
—
|
367
|
+
<div class='inline'><p>is the label of the measurement.</p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</li>
|
371
|
+
|
372
|
+
</ul>
|
373
|
+
|
374
|
+
<p class="tag_title">Returns:</p>
|
375
|
+
<ul class="return">
|
376
|
+
|
377
|
+
<li>
|
378
|
+
|
379
|
+
|
380
|
+
<span class='type'>(<tt>()</tt>)</span>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
</li>
|
385
|
+
|
386
|
+
</ul>
|
387
|
+
|
388
|
+
</div><table class="source_code">
|
389
|
+
<tr>
|
390
|
+
<td>
|
391
|
+
<pre class="lines">
|
392
|
+
|
393
|
+
|
394
|
+
38
|
395
|
+
39
|
396
|
+
40</pre>
|
397
|
+
</td>
|
398
|
+
<td>
|
399
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 38</span>
|
400
|
+
|
401
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_measure'>measure</span><span class='lparen'>(</span><span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
402
|
+
<span class='ivar'>@eff</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
403
|
+
<span class='kw'>end</span></pre>
|
404
|
+
</td>
|
405
|
+
</tr>
|
406
|
+
</table>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
<div class="method_details ">
|
410
|
+
<h3 class="signature " id="with-instance_method">
|
411
|
+
|
412
|
+
#<strong>with</strong>(&th) ⇒ <tt>[A, ...{ label: string, time: float }]!{e}</tt>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
</h3><div class="docstring">
|
419
|
+
<div class="discussion">
|
420
|
+
<p>is a handler to interpret the effect invocation as measuring computation time.</p>
|
421
|
+
|
422
|
+
|
423
|
+
</div>
|
424
|
+
</div>
|
425
|
+
<div class="tags">
|
426
|
+
<p class="tag_title">Parameters:</p>
|
427
|
+
<ul class="param">
|
428
|
+
|
429
|
+
<li>
|
430
|
+
|
431
|
+
<span class='name'>th</span>
|
432
|
+
|
433
|
+
|
434
|
+
<span class='type'>(<tt>Proc<(), A!{<span class='object_link'><a href="../MeasureTime.html" title="Ruff::Standard::MeasureTime (module)">MeasureTime</a></span>.<span class='object_link'><a href="#eff-instance_method" title="Ruff::Standard::MeasureTime::Instance#eff (method)">eff</a></span>, e}></tt>)</span>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
—
|
439
|
+
<div class='inline'><p>is a thunk returning <code>A</code> with the possibility to invoke effects,
|
440
|
+
including <code>MeasureTime.eff</code> .</p>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
</li>
|
444
|
+
|
445
|
+
</ul>
|
446
|
+
|
447
|
+
<p class="tag_title">Returns:</p>
|
448
|
+
<ul class="return">
|
449
|
+
|
450
|
+
<li>
|
451
|
+
|
452
|
+
|
453
|
+
<span class='type'>(<tt>[A, ...{ label: string, time: float }]!{e}</tt>)</span>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
—
|
458
|
+
<div class='inline'><p>returns list. the first is the result <code>A</code>, and the rest is the measurement results.
|
459
|
+
It still has the possibility to invoke effects(<code>e</code>).</p>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</li>
|
463
|
+
|
464
|
+
</ul>
|
465
|
+
|
466
|
+
</div><table class="source_code">
|
467
|
+
<tr>
|
468
|
+
<td>
|
469
|
+
<pre class="lines">
|
470
|
+
|
471
|
+
|
472
|
+
51
|
473
|
+
52
|
474
|
+
53</pre>
|
475
|
+
</td>
|
476
|
+
<td>
|
477
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/standard/measure_time.rb', line 51</span>
|
478
|
+
|
479
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
|
480
|
+
<span class='ivar'>@handler</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_th'>th</span><span class='rparen'>)</span>
|
481
|
+
<span class='kw'>end</span></pre>
|
482
|
+
</td>
|
483
|
+
</tr>
|
484
|
+
</table>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</div>
|
490
|
+
|
491
|
+
<div id="footer">
|
492
|
+
Generated on Fri Oct 4 21:12:21 2019 by
|
493
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
494
|
+
0.9.20 (ruby-2.6.5).
|
495
|
+
</div>
|
496
|
+
|
497
|
+
</div>
|
498
|
+
</body>
|
499
|
+
</html>
|