fantasy 0.1.13 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +22 -1
- data/.yardopts +4 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +55 -0
- data/README.md +14 -6
- data/docs/Actor.html +2737 -0
- data/docs/Background.html +961 -0
- data/docs/Camera.html +791 -0
- data/docs/Clock.html +753 -0
- data/docs/Color.html +776 -0
- data/docs/Coordinates.html +730 -0
- data/docs/Cursor.html +752 -0
- data/docs/Disk.html +236 -0
- data/docs/Draggable.html +198 -0
- data/docs/Fantasy.html +121 -0
- data/docs/Game.html +904 -0
- data/docs/Global.html +2791 -0
- data/docs/Gravitier.html +179 -0
- data/docs/HudImage.html +979 -0
- data/docs/HudText.html +1151 -0
- data/docs/Image.html +506 -0
- data/docs/Jumper.html +189 -0
- data/docs/Mouse.html +226 -0
- data/docs/MoveByCursor.html +374 -0
- data/docs/MoveByDirection.html +179 -0
- data/docs/Mover.html +305 -0
- data/docs/Music.html +524 -0
- data/docs/Shape.html +1057 -0
- data/docs/Sound.html +374 -0
- data/docs/Tilemap.html +491 -0
- data/docs/Tween.html +186 -0
- data/docs/UserInputs.html +879 -0
- data/docs/Utils.html +345 -0
- data/docs/_index.html +346 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.CHANGELOG.html +121 -0
- data/docs/file.README.html +599 -0
- data/docs/file_list.html +61 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +599 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1931 -0
- data/docs/top-level-namespace.html +978 -0
- data/lib/fantasy/actor.rb +455 -123
- data/lib/fantasy/background.rb +109 -13
- data/lib/fantasy/base.rb +113 -1
- data/lib/fantasy/camera.rb +95 -11
- data/lib/fantasy/clock.rb +4 -2
- data/lib/fantasy/color.rb +158 -153
- data/lib/fantasy/coordinates.rb +5 -9
- data/lib/fantasy/cursor.rb +2 -1
- data/lib/fantasy/disk.rb +12 -8
- data/lib/fantasy/draggable.rb +22 -1
- data/lib/fantasy/global.rb +59 -31
- data/lib/fantasy/hud_image.rb +5 -3
- data/lib/fantasy/hud_text.rb +6 -2
- data/lib/fantasy/image.rb +12 -4
- data/lib/fantasy/includes/gravitier.rb +2 -0
- data/lib/fantasy/includes/jumper.rb +3 -2
- data/lib/fantasy/includes/log.rb +12 -0
- data/lib/fantasy/includes/move_by_cursors.rb +24 -15
- data/lib/fantasy/includes/move_by_direction.rb +2 -0
- data/lib/fantasy/includes/mover.rb +3 -0
- data/lib/fantasy/includes/user_inputs.rb +6 -0
- data/lib/fantasy/loop.rb +41 -44
- data/lib/fantasy/mouse.rb +2 -0
- data/lib/fantasy/music.rb +4 -2
- data/lib/fantasy/shape.rb +11 -2
- data/lib/fantasy/sound.rb +3 -1
- data/lib/fantasy/tilemap.rb +19 -13
- data/lib/fantasy/tween.rb +3 -1
- data/lib/fantasy/utils.rb +7 -13
- data/lib/fantasy/version.rb +1 -1
- data/lib/fantasy.rb +2 -0
- metadata +90 -4
- data/fantasy.gemspec +0 -40
- data/fonts/VT323-Regular.ttf +0 -0
data/docs/Clock.html
ADDED
@@ -0,0 +1,753 @@
|
|
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: Clock
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.27
|
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 = "Clock";
|
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> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Clock</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: Clock
|
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">Clock</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/fantasy/clock.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="#persistent-instance_method" title="#persistent (instance method)">#<strong>persistent</strong> ⇒ Object </a>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</span>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute persistent.</p>
|
130
|
+
</div></span>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#thread-instance_method" title="#thread (instance method)">#<strong>thread</strong> ⇒ Object </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="note title readonly">readonly</span>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute thread.</p>
|
158
|
+
</div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
</ul>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<h2>
|
170
|
+
Instance Method Summary
|
171
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
172
|
+
</h2>
|
173
|
+
|
174
|
+
<ul class="summary">
|
175
|
+
|
176
|
+
<li class="public ">
|
177
|
+
<span class="summary_signature">
|
178
|
+
|
179
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(&block) ⇒ Clock </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
<span class="note title constructor">constructor</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Clock.</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#persistent%3F-instance_method" title="#persistent? (instance method)">#<strong>persistent?</strong> ⇒ Boolean </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
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#repeat-instance_method" title="#repeat (instance method)">#<strong>repeat</strong>(seconds: 1, times: Float::INFINITY) ⇒ Object </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li class="public ">
|
246
|
+
<span class="summary_signature">
|
247
|
+
|
248
|
+
<a href="#run_now-instance_method" title="#run_now (instance method)">#<strong>run_now</strong> ⇒ Object </a>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</span>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
|
267
|
+
<li class="public ">
|
268
|
+
<span class="summary_signature">
|
269
|
+
|
270
|
+
<a href="#run_on-instance_method" title="#run_on (instance method)">#<strong>run_on</strong>(seconds:) ⇒ Object </a>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</span>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
285
|
+
|
286
|
+
</li>
|
287
|
+
|
288
|
+
|
289
|
+
<li class="public ">
|
290
|
+
<span class="summary_signature">
|
291
|
+
|
292
|
+
<a href="#started%3F-instance_method" title="#started? (instance method)">#<strong>started?</strong> ⇒ Boolean </a>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
</span>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
307
|
+
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
311
|
+
<li class="public ">
|
312
|
+
<span class="summary_signature">
|
313
|
+
|
314
|
+
<a href="#stop-instance_method" title="#stop (instance method)">#<strong>stop</strong> ⇒ Object </a>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
</span>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
329
|
+
|
330
|
+
</li>
|
331
|
+
|
332
|
+
|
333
|
+
</ul>
|
334
|
+
|
335
|
+
|
336
|
+
<div id="constructor_details" class="method_details_list">
|
337
|
+
<h2>Constructor Details</h2>
|
338
|
+
|
339
|
+
<div class="method_details first">
|
340
|
+
<h3 class="signature first" id="initialize-instance_method">
|
341
|
+
|
342
|
+
#<strong>initialize</strong>(&block) ⇒ <tt><span class='object_link'><a href="" title="Clock (class)">Clock</a></span></tt>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
</h3><div class="docstring">
|
349
|
+
<div class="discussion">
|
350
|
+
<p>Returns a new instance of Clock.</p>
|
351
|
+
|
352
|
+
|
353
|
+
</div>
|
354
|
+
</div>
|
355
|
+
<div class="tags">
|
356
|
+
|
357
|
+
|
358
|
+
</div><table class="source_code">
|
359
|
+
<tr>
|
360
|
+
<td>
|
361
|
+
<pre class="lines">
|
362
|
+
|
363
|
+
|
364
|
+
7
|
365
|
+
8
|
366
|
+
9
|
367
|
+
10
|
368
|
+
11
|
369
|
+
12
|
370
|
+
13</pre>
|
371
|
+
</td>
|
372
|
+
<td>
|
373
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 7</span>
|
374
|
+
|
375
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
376
|
+
<span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
377
|
+
<span class='ivar'>@thread</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
378
|
+
<span class='ivar'>@persistent</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='comment'># if persistent, clock is not stopped when loading new scene
|
379
|
+
</span>
|
380
|
+
<span class='const'><span class='object_link'><a href="Global.html" title="Global (module)">Global</a></span></span><span class='period'>.</span><span class='id identifier rubyid_clocks'><span class='object_link'><a href="Global.html#clocks-class_method" title="Global.clocks (method)">clocks</a></span></span> <span class='op'><<</span> <span class='kw'>self</span>
|
381
|
+
<span class='kw'>end</span></pre>
|
382
|
+
</td>
|
383
|
+
</tr>
|
384
|
+
</table>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
<div id="instance_attr_details" class="attr_details">
|
390
|
+
<h2>Instance Attribute Details</h2>
|
391
|
+
|
392
|
+
|
393
|
+
<span id="persistent=-instance_method"></span>
|
394
|
+
<div class="method_details first">
|
395
|
+
<h3 class="signature first" id="persistent-instance_method">
|
396
|
+
|
397
|
+
#<strong>persistent</strong> ⇒ <tt>Object</tt>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
</h3><div class="docstring">
|
404
|
+
<div class="discussion">
|
405
|
+
<p>Returns the value of attribute persistent.</p>
|
406
|
+
|
407
|
+
|
408
|
+
</div>
|
409
|
+
</div>
|
410
|
+
<div class="tags">
|
411
|
+
|
412
|
+
|
413
|
+
</div><table class="source_code">
|
414
|
+
<tr>
|
415
|
+
<td>
|
416
|
+
<pre class="lines">
|
417
|
+
|
418
|
+
|
419
|
+
4
|
420
|
+
5
|
421
|
+
6</pre>
|
422
|
+
</td>
|
423
|
+
<td>
|
424
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 4</span>
|
425
|
+
|
426
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_persistent'>persistent</span>
|
427
|
+
<span class='ivar'>@persistent</span>
|
428
|
+
<span class='kw'>end</span></pre>
|
429
|
+
</td>
|
430
|
+
</tr>
|
431
|
+
</table>
|
432
|
+
</div>
|
433
|
+
|
434
|
+
|
435
|
+
<span id=""></span>
|
436
|
+
<div class="method_details ">
|
437
|
+
<h3 class="signature " id="thread-instance_method">
|
438
|
+
|
439
|
+
#<strong>thread</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
</h3><div class="docstring">
|
446
|
+
<div class="discussion">
|
447
|
+
<p>Returns the value of attribute thread.</p>
|
448
|
+
|
449
|
+
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
<div class="tags">
|
453
|
+
|
454
|
+
|
455
|
+
</div><table class="source_code">
|
456
|
+
<tr>
|
457
|
+
<td>
|
458
|
+
<pre class="lines">
|
459
|
+
|
460
|
+
|
461
|
+
5
|
462
|
+
6
|
463
|
+
7</pre>
|
464
|
+
</td>
|
465
|
+
<td>
|
466
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 5</span>
|
467
|
+
|
468
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_thread'>thread</span>
|
469
|
+
<span class='ivar'>@thread</span>
|
470
|
+
<span class='kw'>end</span></pre>
|
471
|
+
</td>
|
472
|
+
</tr>
|
473
|
+
</table>
|
474
|
+
</div>
|
475
|
+
|
476
|
+
</div>
|
477
|
+
|
478
|
+
|
479
|
+
<div id="instance_method_details" class="method_details_list">
|
480
|
+
<h2>Instance Method Details</h2>
|
481
|
+
|
482
|
+
|
483
|
+
<div class="method_details first">
|
484
|
+
<h3 class="signature first" id="persistent?-instance_method">
|
485
|
+
|
486
|
+
#<strong>persistent?</strong> ⇒ <tt>Boolean</tt>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</h3><div class="docstring">
|
493
|
+
<div class="discussion">
|
494
|
+
|
495
|
+
|
496
|
+
</div>
|
497
|
+
</div>
|
498
|
+
<div class="tags">
|
499
|
+
|
500
|
+
<p class="tag_title">Returns:</p>
|
501
|
+
<ul class="return">
|
502
|
+
|
503
|
+
<li>
|
504
|
+
|
505
|
+
|
506
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</li>
|
511
|
+
|
512
|
+
</ul>
|
513
|
+
|
514
|
+
</div><table class="source_code">
|
515
|
+
<tr>
|
516
|
+
<td>
|
517
|
+
<pre class="lines">
|
518
|
+
|
519
|
+
|
520
|
+
52
|
521
|
+
53
|
522
|
+
54</pre>
|
523
|
+
</td>
|
524
|
+
<td>
|
525
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 52</span>
|
526
|
+
|
527
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_persistent?'>persistent?</span>
|
528
|
+
<span class='ivar'>@persistent</span>
|
529
|
+
<span class='kw'>end</span></pre>
|
530
|
+
</td>
|
531
|
+
</tr>
|
532
|
+
</table>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div class="method_details ">
|
536
|
+
<h3 class="signature " id="repeat-instance_method">
|
537
|
+
|
538
|
+
#<strong>repeat</strong>(seconds: 1, times: Float::INFINITY) ⇒ <tt>Object</tt>
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
</h3><table class="source_code">
|
545
|
+
<tr>
|
546
|
+
<td>
|
547
|
+
<pre class="lines">
|
548
|
+
|
549
|
+
|
550
|
+
30
|
551
|
+
31
|
552
|
+
32
|
553
|
+
33
|
554
|
+
34
|
555
|
+
35
|
556
|
+
36
|
557
|
+
37
|
558
|
+
38
|
559
|
+
39
|
560
|
+
40
|
561
|
+
41
|
562
|
+
42</pre>
|
563
|
+
</td>
|
564
|
+
<td>
|
565
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 30</span>
|
566
|
+
|
567
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_repeat'>repeat</span><span class='lparen'>(</span><span class='label'>seconds:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>times:</span> <span class='const'>Float</span><span class='op'>::</span><span class='const'>INFINITY</span><span class='rparen'>)</span>
|
568
|
+
<span class='id identifier rubyid_times_executed'>times_executed</span> <span class='op'>=</span> <span class='int'>0</span>
|
569
|
+
<span class='ivar'>@thread</span> <span class='op'>=</span>
|
570
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
571
|
+
<span class='kw'>while</span> <span class='id identifier rubyid_times_executed'>times_executed</span> <span class='op'><</span> <span class='id identifier rubyid_times'>times</span>
|
572
|
+
<span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
573
|
+
<span class='id identifier rubyid_times_executed'>times_executed</span> <span class='op'>+=</span> <span class='int'>1</span>
|
574
|
+
|
575
|
+
<span class='id identifier rubyid_seconds_to_sleep'>seconds_to_sleep</span> <span class='op'>=</span> <span class='id identifier rubyid_seconds'>seconds</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Range</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_rand'>rand</span><span class='lparen'>(</span><span class='id identifier rubyid_seconds'>seconds</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_seconds'>seconds</span>
|
576
|
+
<span class='id identifier rubyid_sleep'>sleep</span><span class='lparen'>(</span><span class='id identifier rubyid_seconds_to_sleep'>seconds_to_sleep</span><span class='rparen'>)</span>
|
577
|
+
<span class='kw'>end</span>
|
578
|
+
<span class='kw'>end</span>
|
579
|
+
<span class='kw'>end</span></pre>
|
580
|
+
</td>
|
581
|
+
</tr>
|
582
|
+
</table>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
<div class="method_details ">
|
586
|
+
<h3 class="signature " id="run_now-instance_method">
|
587
|
+
|
588
|
+
#<strong>run_now</strong> ⇒ <tt>Object</tt>
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
</h3><table class="source_code">
|
595
|
+
<tr>
|
596
|
+
<td>
|
597
|
+
<pre class="lines">
|
598
|
+
|
599
|
+
|
600
|
+
15
|
601
|
+
16
|
602
|
+
17
|
603
|
+
18
|
604
|
+
19
|
605
|
+
20</pre>
|
606
|
+
</td>
|
607
|
+
<td>
|
608
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 15</span>
|
609
|
+
|
610
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_now'>run_now</span>
|
611
|
+
<span class='ivar'>@thread</span> <span class='op'>=</span>
|
612
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
613
|
+
<span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
614
|
+
<span class='kw'>end</span>
|
615
|
+
<span class='kw'>end</span></pre>
|
616
|
+
</td>
|
617
|
+
</tr>
|
618
|
+
</table>
|
619
|
+
</div>
|
620
|
+
|
621
|
+
<div class="method_details ">
|
622
|
+
<h3 class="signature " id="run_on-instance_method">
|
623
|
+
|
624
|
+
#<strong>run_on</strong>(seconds:) ⇒ <tt>Object</tt>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
</h3><table class="source_code">
|
631
|
+
<tr>
|
632
|
+
<td>
|
633
|
+
<pre class="lines">
|
634
|
+
|
635
|
+
|
636
|
+
22
|
637
|
+
23
|
638
|
+
24
|
639
|
+
25
|
640
|
+
26
|
641
|
+
27
|
642
|
+
28</pre>
|
643
|
+
</td>
|
644
|
+
<td>
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 22</span>
|
646
|
+
|
647
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_on'>run_on</span><span class='lparen'>(</span><span class='label'>seconds:</span><span class='rparen'>)</span>
|
648
|
+
<span class='ivar'>@thread</span> <span class='op'>=</span>
|
649
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
650
|
+
<span class='id identifier rubyid_sleep'>sleep</span><span class='lparen'>(</span><span class='id identifier rubyid_seconds'>seconds</span><span class='rparen'>)</span>
|
651
|
+
<span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
652
|
+
<span class='kw'>end</span>
|
653
|
+
<span class='kw'>end</span></pre>
|
654
|
+
</td>
|
655
|
+
</tr>
|
656
|
+
</table>
|
657
|
+
</div>
|
658
|
+
|
659
|
+
<div class="method_details ">
|
660
|
+
<h3 class="signature " id="started?-instance_method">
|
661
|
+
|
662
|
+
#<strong>started?</strong> ⇒ <tt>Boolean</tt>
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
</h3><div class="docstring">
|
669
|
+
<div class="discussion">
|
670
|
+
|
671
|
+
|
672
|
+
</div>
|
673
|
+
</div>
|
674
|
+
<div class="tags">
|
675
|
+
|
676
|
+
<p class="tag_title">Returns:</p>
|
677
|
+
<ul class="return">
|
678
|
+
|
679
|
+
<li>
|
680
|
+
|
681
|
+
|
682
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
</li>
|
687
|
+
|
688
|
+
</ul>
|
689
|
+
|
690
|
+
</div><table class="source_code">
|
691
|
+
<tr>
|
692
|
+
<td>
|
693
|
+
<pre class="lines">
|
694
|
+
|
695
|
+
|
696
|
+
48
|
697
|
+
49
|
698
|
+
50</pre>
|
699
|
+
</td>
|
700
|
+
<td>
|
701
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 48</span>
|
702
|
+
|
703
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_started?'>started?</span>
|
704
|
+
<span class='op'>!</span><span class='ivar'>@thread</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
705
|
+
<span class='kw'>end</span></pre>
|
706
|
+
</td>
|
707
|
+
</tr>
|
708
|
+
</table>
|
709
|
+
</div>
|
710
|
+
|
711
|
+
<div class="method_details ">
|
712
|
+
<h3 class="signature " id="stop-instance_method">
|
713
|
+
|
714
|
+
#<strong>stop</strong> ⇒ <tt>Object</tt>
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
</h3><table class="source_code">
|
721
|
+
<tr>
|
722
|
+
<td>
|
723
|
+
<pre class="lines">
|
724
|
+
|
725
|
+
|
726
|
+
44
|
727
|
+
45
|
728
|
+
46</pre>
|
729
|
+
</td>
|
730
|
+
<td>
|
731
|
+
<pre class="code"><span class="info file"># File 'lib/fantasy/clock.rb', line 44</span>
|
732
|
+
|
733
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span>
|
734
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='ivar'>@thread</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@thread</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
735
|
+
<span class='kw'>end</span></pre>
|
736
|
+
</td>
|
737
|
+
</tr>
|
738
|
+
</table>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
</div>
|
742
|
+
|
743
|
+
</div>
|
744
|
+
|
745
|
+
<div id="footer">
|
746
|
+
Generated on Sat Apr 2 14:24:12 2022 by
|
747
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
748
|
+
0.9.27 (ruby-3.0.2).
|
749
|
+
</div>
|
750
|
+
|
751
|
+
</div>
|
752
|
+
</body>
|
753
|
+
</html>
|