quna 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 199161b7ff364c4759c080cb36180c00836fc51c4ddb53eaccf49eaa205c5e18
4
+ data.tar.gz: fde2fd6bfd526329ec597b98aacca9a6673f058f0203ce04e489f429bbfb7bea
5
+ SHA512:
6
+ metadata.gz: b602b677f0c1018048499d7f4c4baa9735cf936a8e05cf7e99912758945c27bcc3c34c25a5070d50c004c16a702239b786477a4216549dedc5a21b5213e1c0a8
7
+ data.tar.gz: 07a91a7710d41e6e86b2262c73f7b4041e8fdf5242dcf6898bd249d09b0efb9e08eec54686258ae44e7ae0f50da0091a31ad6a29742306c52c46d338245a6ea4
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,5 @@
1
+ = Version history
2
+
3
+ [0.0.2] Cleanups.
4
+
5
+ [0.0.1] Initial version.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2018 tero.isannainen@gmail.com
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,21 @@
1
+ = Quna
2
+
3
+ {Quna} is a library for making it simple to query
4
+ interactively answers from users.
5
+
6
+ == Example
7
+
8
+ First the Query object should be created:
9
+
10
+ q = Quna::Query.new
11
+
12
+ Then queries can be made for Y/N answers or generic questions:
13
+
14
+ puts "answer is: " + q.ask_yn_bool( "what" ).to_s
15
+ puts "answer is: " + q.ask( "How are you" ).to_s
16
+
17
+
18
+
19
+ == Testing
20
+
21
+ TBD
data/doc/Quna.html ADDED
@@ -0,0 +1,206 @@
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: Quna
8
+
9
+ &mdash; Documentation by YARD 0.9.25
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 = "Quna";
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 (Q)</a> &raquo;
40
+
41
+
42
+ <span class="title">Quna</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: Quna
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">Quna</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/version.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+ <h2>
105
+ Constant Summary
106
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="VERSION-constant" class="">VERSION =
112
+
113
+ </dt>
114
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.0.2</span><span class='tstring_end'>&quot;</span></span></pre></dd>
115
+
116
+ </dl>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h2>
127
+ Class Method Summary
128
+ <small><a href="#" class="summary_toggle">collapse</a></small>
129
+ </h2>
130
+
131
+ <ul class="summary">
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#version-class_method" title="version (class method)">.<strong>version</strong> &#x21d2; Object </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'></div></span>
151
+
152
+ </li>
153
+
154
+
155
+ </ul>
156
+
157
+
158
+
159
+
160
+ <div id="class_method_details" class="method_details_list">
161
+ <h2>Class Method Details</h2>
162
+
163
+
164
+ <div class="method_details first">
165
+ <h3 class="signature first" id="version-class_method">
166
+
167
+ .<strong>version</strong> &#x21d2; <tt>Object</tt>
168
+
169
+
170
+
171
+
172
+
173
+ </h3><table class="source_code">
174
+ <tr>
175
+ <td>
176
+ <pre class="lines">
177
+
178
+
179
+ 3
180
+ 4
181
+ 5</pre>
182
+ </td>
183
+ <td>
184
+ <pre class="code"><span class="info file"># File 'lib/version.rb', line 3</span>
185
+
186
+ <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Quna (class)">Quna</a></span></span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span>
187
+ <span class='const'><span class='object_link'><a href="" title="Quna (class)">Quna</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="#VERSION-constant" title="Quna::VERSION (constant)">VERSION</a></span></span>
188
+ <span class='kw'>end</span></pre>
189
+ </td>
190
+ </tr>
191
+ </table>
192
+ </div>
193
+
194
+ </div>
195
+
196
+ </div>
197
+
198
+ <div id="footer">
199
+ Generated on Fri Jun 4 23:18:40 2021 by
200
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
201
+ 0.9.25 (ruby-2.7.2).
202
+ </div>
203
+
204
+ </div>
205
+ </body>
206
+ </html>
@@ -0,0 +1,808 @@
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: Quna::Query
8
+
9
+ &mdash; Documentation by YARD 0.9.25
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 = "Quna::Query";
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 (Q)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Quna.html" title="Quna (module)">Quna</a></span></span>
41
+ &raquo;
42
+ <span class="title">Query</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: Quna::Query
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">Quna::Query</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/quna.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Basic user query.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ <h2>
122
+ Instance Method Summary
123
+ <small><a href="#" class="summary_toggle">collapse</a></small>
124
+ </h2>
125
+
126
+ <ul class="summary">
127
+
128
+ <li class="public ">
129
+ <span class="summary_signature">
130
+
131
+ <a href="#ask-instance_method" title="#ask (instance method)">#<strong>ask</strong>(question) &#x21d2; Object </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>Ask generic question.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#ask_relaxed-instance_method" title="#ask_relaxed (instance method)">#<strong>ask_relaxed</strong>(question) &#x21d2; Object </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Ask generic question without any requirements for answer.</p>
171
+ </div></span>
172
+
173
+ </li>
174
+
175
+
176
+ <li class="public ">
177
+ <span class="summary_signature">
178
+
179
+ <a href="#ask_yn-instance_method" title="#ask_yn (instance method)">#<strong>ask_yn</strong>(question) &#x21d2; Object </a>
180
+
181
+
182
+
183
+ </span>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Ask y/n question until answer is received.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#ask_yn_bool-instance_method" title="#ask_yn_bool (instance method)">#<strong>ask_yn_bool</strong>(question) &#x21d2; Object </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc"><div class='inline'>
218
+ <p>Ask y/n question and return boolean result, i.e.</p>
219
+ </div></span>
220
+
221
+ </li>
222
+
223
+
224
+ <li class="public ">
225
+ <span class="summary_signature">
226
+
227
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(default_answer = nil) &#x21d2; Query </a>
228
+
229
+
230
+
231
+ </span>
232
+
233
+
234
+ <span class="note title constructor">constructor</span>
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+ <span class="summary_desc"><div class='inline'>
244
+ <p>A new instance of Query.</p>
245
+ </div></span>
246
+
247
+ </li>
248
+
249
+
250
+ <li class="public ">
251
+ <span class="summary_signature">
252
+
253
+ <a href="#prompt-instance_method" title="#prompt (instance method)">#<strong>prompt</strong> &#x21d2; Object </a>
254
+
255
+
256
+
257
+ </span>
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+ <span class="summary_desc"><div class='inline'>
268
+ <p>Create prompt string for generic question.</p>
269
+ </div></span>
270
+
271
+ </li>
272
+
273
+
274
+ <li class="public ">
275
+ <span class="summary_signature">
276
+
277
+ <a href="#prompt_yn-instance_method" title="#prompt_yn (instance method)">#<strong>prompt_yn</strong> &#x21d2; Object </a>
278
+
279
+
280
+
281
+ </span>
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ <span class="summary_desc"><div class='inline'>
292
+ <p>Create prompt string for y/n question.</p>
293
+ </div></span>
294
+
295
+ </li>
296
+
297
+
298
+ <li class="public ">
299
+ <span class="summary_signature">
300
+
301
+ <a href="#set_question-instance_method" title="#set_question (instance method)">#<strong>set_question</strong>(question) &#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>Store asked question.</p>
317
+ </div></span>
318
+
319
+ </li>
320
+
321
+
322
+ </ul>
323
+
324
+
325
+ <div id="constructor_details" class="method_details_list">
326
+ <h2>Constructor Details</h2>
327
+
328
+ <div class="method_details first">
329
+ <h3 class="signature first" id="initialize-instance_method">
330
+
331
+ #<strong>initialize</strong>(default_answer = nil) &#x21d2; <tt><span class='object_link'><a href="" title="Quna::Query (class)">Query</a></span></tt>
332
+
333
+
334
+
335
+
336
+
337
+ </h3><div class="docstring">
338
+ <div class="discussion">
339
+
340
+ <p>Returns a new instance of Query.</p>
341
+
342
+
343
+ </div>
344
+ </div>
345
+ <div class="tags">
346
+
347
+
348
+ </div><table class="source_code">
349
+ <tr>
350
+ <td>
351
+ <pre class="lines">
352
+
353
+
354
+ 20
355
+ 21
356
+ 22
357
+ 23
358
+ 24
359
+ 25
360
+ 26
361
+ 27
362
+ 28</pre>
363
+ </td>
364
+ <td>
365
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 20</span>
366
+
367
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_default_answer'>default_answer</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
368
+ <span class='ivar'>@question</span> <span class='op'>=</span> <span class='kw'>nil</span>
369
+ <span class='ivar'>@default_answer</span> <span class='op'>=</span> <span class='id identifier rubyid_default_answer'>default_answer</span>
370
+ <span class='ivar'>@answer</span> <span class='op'>=</span> <span class='kw'>nil</span>
371
+
372
+ <span class='ivar'>@opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
373
+ <span class='label'>no_answer_limit:</span> <span class='kw'>nil</span><span class='comma'>,</span>
374
+ <span class='rbrace'>}</span>
375
+ <span class='kw'>end</span></pre>
376
+ </td>
377
+ </tr>
378
+ </table>
379
+ </div>
380
+
381
+ </div>
382
+
383
+
384
+ <div id="instance_method_details" class="method_details_list">
385
+ <h2>Instance Method Details</h2>
386
+
387
+
388
+ <div class="method_details first">
389
+ <h3 class="signature first" id="ask-instance_method">
390
+
391
+ #<strong>ask</strong>(question) &#x21d2; <tt>Object</tt>
392
+
393
+
394
+
395
+
396
+
397
+ </h3><div class="docstring">
398
+ <div class="discussion">
399
+
400
+ <p>Ask generic question.</p>
401
+
402
+
403
+ </div>
404
+ </div>
405
+ <div class="tags">
406
+
407
+ <p class="tag_title">Raises:</p>
408
+ <ul class="raise">
409
+
410
+ <li>
411
+
412
+
413
+ <span class='type'>(<tt><span class='object_link'><a href="QunaInterrupt.html" title="Quna::QunaInterrupt (class)">QunaInterrupt</a></span></tt>)</span>
414
+
415
+
416
+
417
+ </li>
418
+
419
+ </ul>
420
+
421
+ </div><table class="source_code">
422
+ <tr>
423
+ <td>
424
+ <pre class="lines">
425
+
426
+
427
+ 92
428
+ 93
429
+ 94
430
+ 95
431
+ 96
432
+ 97</pre>
433
+ </td>
434
+ <td>
435
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 92</span>
436
+
437
+ <span class='kw'>def</span> <span class='id identifier rubyid_ask'>ask</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
438
+ <span class='id identifier rubyid_set_question'>set_question</span> <span class='id identifier rubyid_question'>question</span>
439
+ <span class='id identifier rubyid_answer'>answer</span> <span class='op'>=</span> <span class='const'>Readline</span><span class='period'>.</span><span class='id identifier rubyid_readline'>readline</span><span class='lparen'>(</span> <span class='id identifier rubyid_prompt'>prompt</span> <span class='rparen'>)</span>
440
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span> <span class='const'><span class='object_link'><a href="QunaInterrupt.html" title="Quna::QunaInterrupt (class)">QunaInterrupt</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_prompt'>prompt</span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_answer'>answer</span>
441
+ <span class='id identifier rubyid_answer'>answer</span>
442
+ <span class='kw'>end</span></pre>
443
+ </td>
444
+ </tr>
445
+ </table>
446
+ </div>
447
+
448
+ <div class="method_details ">
449
+ <h3 class="signature " id="ask_relaxed-instance_method">
450
+
451
+ #<strong>ask_relaxed</strong>(question) &#x21d2; <tt>Object</tt>
452
+
453
+
454
+
455
+
456
+
457
+ </h3><div class="docstring">
458
+ <div class="discussion">
459
+
460
+ <p>Ask generic question without any requirements for answer.</p>
461
+
462
+
463
+ </div>
464
+ </div>
465
+ <div class="tags">
466
+
467
+
468
+ </div><table class="source_code">
469
+ <tr>
470
+ <td>
471
+ <pre class="lines">
472
+
473
+
474
+ 101
475
+ 102
476
+ 103
477
+ 104
478
+ 105</pre>
479
+ </td>
480
+ <td>
481
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 101</span>
482
+
483
+ <span class='kw'>def</span> <span class='id identifier rubyid_ask_relaxed'>ask_relaxed</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
484
+ <span class='id identifier rubyid_set_question'>set_question</span> <span class='id identifier rubyid_question'>question</span>
485
+ <span class='id identifier rubyid_answer'>answer</span> <span class='op'>=</span> <span class='const'>Readline</span><span class='period'>.</span><span class='id identifier rubyid_readline'>readline</span><span class='lparen'>(</span> <span class='id identifier rubyid_prompt'>prompt</span> <span class='rparen'>)</span>
486
+ <span class='id identifier rubyid_answer'>answer</span>
487
+ <span class='kw'>end</span></pre>
488
+ </td>
489
+ </tr>
490
+ </table>
491
+ </div>
492
+
493
+ <div class="method_details ">
494
+ <h3 class="signature " id="ask_yn-instance_method">
495
+
496
+ #<strong>ask_yn</strong>(question) &#x21d2; <tt>Object</tt>
497
+
498
+
499
+
500
+
501
+
502
+ </h3><div class="docstring">
503
+ <div class="discussion">
504
+
505
+ <p>Ask y/n question until answer is received.</p>
506
+
507
+
508
+ </div>
509
+ </div>
510
+ <div class="tags">
511
+
512
+
513
+ </div><table class="source_code">
514
+ <tr>
515
+ <td>
516
+ <pre class="lines">
517
+
518
+
519
+ 38
520
+ 39
521
+ 40
522
+ 41
523
+ 42
524
+ 43
525
+ 44
526
+ 45
527
+ 46
528
+ 47
529
+ 48
530
+ 49
531
+ 50
532
+ 51
533
+ 52
534
+ 53
535
+ 54
536
+ 55
537
+ 56
538
+ 57
539
+ 58
540
+ 59
541
+ 60
542
+ 61
543
+ 62
544
+ 63
545
+ 64
546
+ 65
547
+ 66
548
+ 67
549
+ 68
550
+ 69
551
+ 70
552
+ 71
553
+ 72
554
+ 73
555
+ 74
556
+ 75
557
+ 76</pre>
558
+ </td>
559
+ <td>
560
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 38</span>
561
+
562
+ <span class='kw'>def</span> <span class='id identifier rubyid_ask_yn'>ask_yn</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
563
+ <span class='id identifier rubyid_set_question'>set_question</span> <span class='id identifier rubyid_question'>question</span>
564
+
565
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='symbol'>:no</span>
566
+
567
+ <span class='id identifier rubyid_no_answer_count'>no_answer_count</span> <span class='op'>=</span> <span class='int'>0</span>
568
+
569
+ <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
570
+ <span class='id identifier rubyid_answer'>answer</span> <span class='op'>=</span> <span class='const'>Readline</span><span class='period'>.</span><span class='id identifier rubyid_readline'>readline</span><span class='lparen'>(</span> <span class='id identifier rubyid_prompt_yn'>prompt_yn</span> <span class='rparen'>)</span>
571
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_answer'>answer</span>
572
+
573
+ <span class='kw'>when</span> <span class='kw'>nil</span>
574
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span> <span class='const'><span class='object_link'><a href="QunaInterrupt.html" title="Quna::QunaInterrupt (class)">QunaInterrupt</a></span></span><span class='comma'>,</span> <span class='ivar'>@question</span> <span class='rparen'>)</span>
575
+
576
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
577
+ <span class='kw'>if</span> <span class='ivar'>@default_answer</span>
578
+ <span class='ivar'>@default_answer</span>
579
+ <span class='kw'>else</span>
580
+ <span class='id identifier rubyid_no_answer_count'>no_answer_count</span> <span class='op'>+=</span> <span class='int'>1</span>
581
+ <span class='kw'>if</span> <span class='ivar'>@opts</span><span class='lbracket'>[</span> <span class='symbol'>:no_answer_limit</span> <span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_no_answer_count'>no_answer_count</span> <span class='op'>&gt;=</span> <span class='ivar'>@opts</span><span class='lbracket'>[</span> <span class='symbol'>:no_answer_limit</span> <span class='rbracket'>]</span>
582
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span> <span class='const'><span class='object_link'><a href="QunaNoAnswer.html" title="Quna::QunaNoAnswer (class)">QunaNoAnswer</a></span></span><span class='comma'>,</span> <span class='ivar'>@question</span> <span class='rparen'>)</span>
583
+ <span class='kw'>end</span>
584
+ <span class='kw'>nil</span>
585
+ <span class='kw'>end</span>
586
+
587
+ <span class='kw'>else</span>
588
+ <span class='id identifier rubyid_lowcase'>lowcase</span> <span class='op'>=</span> <span class='id identifier rubyid_answer'>answer</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
589
+ <span class='kw'>case</span> <span class='id identifier rubyid_lowcase'>lowcase</span>
590
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>y</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'>yes</span><span class='tstring_end'>&#39;</span></span><span class='semicolon'>;</span> <span class='symbol'>:yes</span>
591
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>n</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'>no</span><span class='tstring_end'>&#39;</span></span><span class='semicolon'>;</span> <span class='symbol'>:no</span>
592
+ <span class='kw'>else</span> <span class='kw'>nil</span>
593
+ <span class='kw'>end</span>
594
+ <span class='kw'>end</span>
595
+
596
+ <span class='kw'>break</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span>
597
+ <span class='kw'>end</span>
598
+
599
+ <span class='id identifier rubyid_result'>result</span>
600
+ <span class='kw'>end</span></pre>
601
+ </td>
602
+ </tr>
603
+ </table>
604
+ </div>
605
+
606
+ <div class="method_details ">
607
+ <h3 class="signature " id="ask_yn_bool-instance_method">
608
+
609
+ #<strong>ask_yn_bool</strong>(question) &#x21d2; <tt>Object</tt>
610
+
611
+
612
+
613
+
614
+
615
+ </h3><div class="docstring">
616
+ <div class="discussion">
617
+
618
+ <p>Ask y/n question and return boolean result, i.e. TRUE for yes and FALSE for no.</p>
619
+
620
+
621
+ </div>
622
+ </div>
623
+ <div class="tags">
624
+
625
+
626
+ </div><table class="source_code">
627
+ <tr>
628
+ <td>
629
+ <pre class="lines">
630
+
631
+
632
+ 81
633
+ 82
634
+ 83
635
+ 84
636
+ 85
637
+ 86
638
+ 87
639
+ 88</pre>
640
+ </td>
641
+ <td>
642
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 81</span>
643
+
644
+ <span class='kw'>def</span> <span class='id identifier rubyid_ask_yn_bool'>ask_yn_bool</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
645
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_ask_yn'>ask_yn</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
646
+ <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>==</span> <span class='symbol'>:yes</span>
647
+ <span class='kw'>true</span>
648
+ <span class='kw'>else</span>
649
+ <span class='kw'>false</span>
650
+ <span class='kw'>end</span>
651
+ <span class='kw'>end</span></pre>
652
+ </td>
653
+ </tr>
654
+ </table>
655
+ </div>
656
+
657
+ <div class="method_details ">
658
+ <h3 class="signature " id="prompt-instance_method">
659
+
660
+ #<strong>prompt</strong> &#x21d2; <tt>Object</tt>
661
+
662
+
663
+
664
+
665
+
666
+ </h3><div class="docstring">
667
+ <div class="discussion">
668
+
669
+ <p>Create prompt string for generic question.</p>
670
+
671
+
672
+ </div>
673
+ </div>
674
+ <div class="tags">
675
+
676
+
677
+ </div><table class="source_code">
678
+ <tr>
679
+ <td>
680
+ <pre class="lines">
681
+
682
+
683
+ 123
684
+ 124
685
+ 125</pre>
686
+ </td>
687
+ <td>
688
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 123</span>
689
+
690
+ <span class='kw'>def</span> <span class='id identifier rubyid_prompt'>prompt</span>
691
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@question</span><span class='embexpr_end'>}</span><span class='tstring_content'>? </span><span class='tstring_end'>&quot;</span></span>
692
+ <span class='kw'>end</span></pre>
693
+ </td>
694
+ </tr>
695
+ </table>
696
+ </div>
697
+
698
+ <div class="method_details ">
699
+ <h3 class="signature " id="prompt_yn-instance_method">
700
+
701
+ #<strong>prompt_yn</strong> &#x21d2; <tt>Object</tt>
702
+
703
+
704
+
705
+
706
+
707
+ </h3><div class="docstring">
708
+ <div class="discussion">
709
+
710
+ <p>Create prompt string for y/n question.</p>
711
+
712
+
713
+ </div>
714
+ </div>
715
+ <div class="tags">
716
+
717
+
718
+ </div><table class="source_code">
719
+ <tr>
720
+ <td>
721
+ <pre class="lines">
722
+
723
+
724
+ 109
725
+ 110
726
+ 111
727
+ 112
728
+ 113
729
+ 114
730
+ 115
731
+ 116
732
+ 117
733
+ 118
734
+ 119</pre>
735
+ </td>
736
+ <td>
737
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 109</span>
738
+
739
+ <span class='kw'>def</span> <span class='id identifier rubyid_prompt_yn'>prompt_yn</span>
740
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='kw'>nil</span>
741
+ <span class='kw'>if</span> <span class='ivar'>@default_answer</span> <span class='op'>==</span> <span class='symbol'>:yes</span>
742
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[Y/n]</span><span class='tstring_end'>&quot;</span></span>
743
+ <span class='kw'>elsif</span> <span class='ivar'>@default_answer</span> <span class='op'>==</span> <span class='symbol'>:no</span>
744
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[y/N]</span><span class='tstring_end'>&quot;</span></span>
745
+ <span class='kw'>else</span>
746
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[y/n]</span><span class='tstring_end'>&quot;</span></span>
747
+ <span class='kw'>end</span>
748
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@question</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='embexpr_end'>}</span><span class='tstring_content'>? </span><span class='tstring_end'>&quot;</span></span>
749
+ <span class='kw'>end</span></pre>
750
+ </td>
751
+ </tr>
752
+ </table>
753
+ </div>
754
+
755
+ <div class="method_details ">
756
+ <h3 class="signature " id="set_question-instance_method">
757
+
758
+ #<strong>set_question</strong>(question) &#x21d2; <tt>Object</tt>
759
+
760
+
761
+
762
+
763
+
764
+ </h3><div class="docstring">
765
+ <div class="discussion">
766
+
767
+ <p>Store asked question.</p>
768
+
769
+
770
+ </div>
771
+ </div>
772
+ <div class="tags">
773
+
774
+
775
+ </div><table class="source_code">
776
+ <tr>
777
+ <td>
778
+ <pre class="lines">
779
+
780
+
781
+ 32
782
+ 33
783
+ 34</pre>
784
+ </td>
785
+ <td>
786
+ <pre class="code"><span class="info file"># File 'lib/quna.rb', line 32</span>
787
+
788
+ <span class='kw'>def</span> <span class='id identifier rubyid_set_question'>set_question</span><span class='lparen'>(</span> <span class='id identifier rubyid_question'>question</span> <span class='rparen'>)</span>
789
+ <span class='ivar'>@question</span> <span class='op'>=</span> <span class='id identifier rubyid_question'>question</span>
790
+ <span class='kw'>end</span></pre>
791
+ </td>
792
+ </tr>
793
+ </table>
794
+ </div>
795
+
796
+ </div>
797
+
798
+ </div>
799
+
800
+ <div id="footer">
801
+ Generated on Fri Jun 4 23:18:40 2021 by
802
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
803
+ 0.9.25 (ruby-2.7.2).
804
+ </div>
805
+
806
+ </div>
807
+ </body>
808
+ </html>