my_help 1.2.3 → 1.2.4p1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +1 -1
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +10 -11
- data/README.org +117 -84
- data/README_e.org +110 -0
- data/development_memo.org +5 -0
- data/doc/MyHelp/CLI.html +751 -0
- data/doc/MyHelp/Config.html +693 -0
- data/doc/MyHelp/Error.html +124 -0
- data/doc/MyHelp/GetConfig.html +196 -0
- data/doc/MyHelp/Git.html +291 -0
- data/doc/MyHelp/Init.html +449 -0
- data/doc/MyHelp/List.html +581 -0
- data/doc/MyHelp/Md2Hash.html +632 -0
- data/doc/MyHelp/Modify.html +393 -0
- data/doc/MyHelp/Org2Hash.html +544 -0
- data/doc/MyHelp.html +135 -0
- data/doc/Org2Yaml.html +497 -0
- data/doc/_index.html +230 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +181 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +181 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +451 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/my_help/cli.rb +28 -2
- data/lib/my_help/org2hash.rb +2 -1
- data/lib/my_help/version.rb +1 -1
- data/lib/templates/emacs.org +2 -1
- data/lib/templates/emacs_j.org +76 -0
- data/lib/templates/example.org +3 -2
- data/lib/templates/my_help_j.org +24 -0
- data/lib/templates/org_j.org +25 -0
- data/my_help_install.org +33 -0
- metadata +34 -5
- data/README_j.org +0 -143
- data/tmp.txt +0 -14
@@ -0,0 +1,693 @@
|
|
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: MyHelp::Config
|
8
|
+
|
9
|
+
— my_help
|
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 = "MyHelp::Config";
|
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
|
+
<span class='title'><span class='object_link'><a href="../MyHelp.html" title="MyHelp (module)">MyHelp</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Config</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: MyHelp::Config
|
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">MyHelp::Config</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/my_help/config.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>make @config from default and load yaml as shown <a href="https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem">stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem</a></p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
118
|
+
<ul class="summary">
|
119
|
+
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#config-instance_method" title="#config (instance method)">#<strong>config</strong> ⇒ Object </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="note title readonly">readonly</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>Returns the value of attribute config.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#valid_config_keys-instance_method" title="#valid_config_keys (instance method)">#<strong>valid_config_keys</strong> ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="note title readonly">readonly</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Returns the value of attribute valid_config_keys.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
</ul>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<h2>
|
185
|
+
Instance Method Summary
|
186
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
187
|
+
</h2>
|
188
|
+
|
189
|
+
<ul class="summary">
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(sym) ⇒ Object </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
209
|
+
|
210
|
+
</li>
|
211
|
+
|
212
|
+
|
213
|
+
<li class="public ">
|
214
|
+
<span class="summary_signature">
|
215
|
+
|
216
|
+
<a href="#configure-instance_method" title="#configure (instance method)">#<strong>configure</strong>(opts = nil) ⇒ Object </a>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
</span>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
<span class="summary_desc"><div class='inline'>
|
231
|
+
<p>Configure through hash.</p>
|
232
|
+
</div></span>
|
233
|
+
|
234
|
+
</li>
|
235
|
+
|
236
|
+
|
237
|
+
<li class="public ">
|
238
|
+
<span class="summary_signature">
|
239
|
+
|
240
|
+
<a href="#configure_with-instance_method" title="#configure_with (instance method)">#<strong>configure_with</strong>(path) ⇒ Object </a>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
</span>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
<span class="summary_desc"><div class='inline'>
|
255
|
+
<p>Configure through yaml file.</p>
|
256
|
+
</div></span>
|
257
|
+
|
258
|
+
</li>
|
259
|
+
|
260
|
+
|
261
|
+
<li class="public ">
|
262
|
+
<span class="summary_signature">
|
263
|
+
|
264
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(conf_path = nil) ⇒ Config </a>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
</span>
|
269
|
+
|
270
|
+
|
271
|
+
<span class="note title constructor">constructor</span>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
<span class="summary_desc"><div class='inline'>
|
281
|
+
<p>Configuration defaults.</p>
|
282
|
+
</div></span>
|
283
|
+
|
284
|
+
</li>
|
285
|
+
|
286
|
+
|
287
|
+
<li class="public ">
|
288
|
+
<span class="summary_signature">
|
289
|
+
|
290
|
+
<a href="#save_config-instance_method" title="#save_config (instance method)">#<strong>save_config</strong> ⇒ Object </a>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</span>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<span class="summary_desc"><div class='inline'>
|
305
|
+
<p>save config in @<a href=":conf_file">config</a>.</p>
|
306
|
+
</div></span>
|
307
|
+
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
311
|
+
</ul>
|
312
|
+
|
313
|
+
|
314
|
+
<div id="constructor_details" class="method_details_list">
|
315
|
+
<h2>Constructor Details</h2>
|
316
|
+
|
317
|
+
<div class="method_details first">
|
318
|
+
<h3 class="signature first" id="initialize-instance_method">
|
319
|
+
|
320
|
+
#<strong>initialize</strong>(conf_path = nil) ⇒ <tt><span class='object_link'><a href="" title="MyHelp::Config (class)">Config</a></span></tt>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
</h3><div class="docstring">
|
327
|
+
<div class="discussion">
|
328
|
+
|
329
|
+
<p>Configuration defaults</p>
|
330
|
+
|
331
|
+
|
332
|
+
</div>
|
333
|
+
</div>
|
334
|
+
<div class="tags">
|
335
|
+
|
336
|
+
|
337
|
+
</div><table class="source_code">
|
338
|
+
<tr>
|
339
|
+
<td>
|
340
|
+
<pre class="lines">
|
341
|
+
|
342
|
+
|
343
|
+
9
|
344
|
+
10
|
345
|
+
11
|
346
|
+
12
|
347
|
+
13
|
348
|
+
14
|
349
|
+
15
|
350
|
+
16
|
351
|
+
17
|
352
|
+
18
|
353
|
+
19
|
354
|
+
20
|
355
|
+
21
|
356
|
+
22
|
357
|
+
23
|
358
|
+
24</pre>
|
359
|
+
</td>
|
360
|
+
<td>
|
361
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 9</span>
|
362
|
+
|
363
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_conf_path'>conf_path</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
364
|
+
<span class='id identifier rubyid_conf_path'>conf_path</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>HOME</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
365
|
+
<span class='id identifier rubyid_local_help_dir'>local_help_dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_conf_path'>conf_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.my_help</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
366
|
+
<span class='ivar'>@config</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
367
|
+
<span class='label'>template_dir:</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>../templates</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid___dir__'>__dir__</span><span class='rparen'>)</span><span class='comma'>,</span>
|
368
|
+
<span class='label'>local_help_dir:</span> <span class='id identifier rubyid_local_help_dir'>local_help_dir</span><span class='comma'>,</span>
|
369
|
+
<span class='label'>conf_file:</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_conf_path'>conf_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.my_help_conf.yml</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span>
|
370
|
+
<span class='label'>editor:</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>EDITOR</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>emacs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
371
|
+
<span class='label'>ext:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.org</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
372
|
+
<span class='label'>verbose:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
373
|
+
<span class='rbrace'>}</span>
|
374
|
+
<span class='ivar'>@valid_config_keys</span> <span class='op'>=</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
375
|
+
<span class='id identifier rubyid_configure_with'>configure_with</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:conf_file</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
376
|
+
<span class='comment'># YAML.dump(@config, File.open(@config[:conf_file], 'w'))
|
377
|
+
</span> <span class='comment'># no good for multiple testers.
|
378
|
+
</span><span class='kw'>end</span></pre>
|
379
|
+
</td>
|
380
|
+
</tr>
|
381
|
+
</table>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div id="instance_attr_details" class="attr_details">
|
387
|
+
<h2>Instance Attribute Details</h2>
|
388
|
+
|
389
|
+
|
390
|
+
<span id=""></span>
|
391
|
+
<div class="method_details first">
|
392
|
+
<h3 class="signature first" id="config-instance_method">
|
393
|
+
|
394
|
+
#<strong>config</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</h3><div class="docstring">
|
401
|
+
<div class="discussion">
|
402
|
+
|
403
|
+
<p>Returns the value of attribute config.</p>
|
404
|
+
|
405
|
+
|
406
|
+
</div>
|
407
|
+
</div>
|
408
|
+
<div class="tags">
|
409
|
+
|
410
|
+
|
411
|
+
</div><table class="source_code">
|
412
|
+
<tr>
|
413
|
+
<td>
|
414
|
+
<pre class="lines">
|
415
|
+
|
416
|
+
|
417
|
+
64
|
418
|
+
65
|
419
|
+
66</pre>
|
420
|
+
</td>
|
421
|
+
<td>
|
422
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 64</span>
|
423
|
+
|
424
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
|
425
|
+
<span class='ivar'>@config</span>
|
426
|
+
<span class='kw'>end</span></pre>
|
427
|
+
</td>
|
428
|
+
</tr>
|
429
|
+
</table>
|
430
|
+
</div>
|
431
|
+
|
432
|
+
|
433
|
+
<span id=""></span>
|
434
|
+
<div class="method_details ">
|
435
|
+
<h3 class="signature " id="valid_config_keys-instance_method">
|
436
|
+
|
437
|
+
#<strong>valid_config_keys</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
</h3><div class="docstring">
|
444
|
+
<div class="discussion">
|
445
|
+
|
446
|
+
<p>Returns the value of attribute valid_config_keys.</p>
|
447
|
+
|
448
|
+
|
449
|
+
</div>
|
450
|
+
</div>
|
451
|
+
<div class="tags">
|
452
|
+
|
453
|
+
|
454
|
+
</div><table class="source_code">
|
455
|
+
<tr>
|
456
|
+
<td>
|
457
|
+
<pre class="lines">
|
458
|
+
|
459
|
+
|
460
|
+
7
|
461
|
+
8
|
462
|
+
9</pre>
|
463
|
+
</td>
|
464
|
+
<td>
|
465
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 7</span>
|
466
|
+
|
467
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_valid_config_keys'>valid_config_keys</span>
|
468
|
+
<span class='ivar'>@valid_config_keys</span>
|
469
|
+
<span class='kw'>end</span></pre>
|
470
|
+
</td>
|
471
|
+
</tr>
|
472
|
+
</table>
|
473
|
+
</div>
|
474
|
+
|
475
|
+
</div>
|
476
|
+
|
477
|
+
|
478
|
+
<div id="instance_method_details" class="method_details_list">
|
479
|
+
<h2>Instance Method Details</h2>
|
480
|
+
|
481
|
+
|
482
|
+
<div class="method_details first">
|
483
|
+
<h3 class="signature first" id="[]-instance_method">
|
484
|
+
|
485
|
+
#<strong>[]</strong>(sym) ⇒ <tt>Object</tt>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
</h3><table class="source_code">
|
492
|
+
<tr>
|
493
|
+
<td>
|
494
|
+
<pre class="lines">
|
495
|
+
|
496
|
+
|
497
|
+
66
|
498
|
+
67
|
499
|
+
68</pre>
|
500
|
+
</td>
|
501
|
+
<td>
|
502
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 66</span>
|
503
|
+
|
504
|
+
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span>
|
505
|
+
<span class='ivar'>@config</span><span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='rbracket'>]</span>
|
506
|
+
<span class='kw'>end</span></pre>
|
507
|
+
</td>
|
508
|
+
</tr>
|
509
|
+
</table>
|
510
|
+
</div>
|
511
|
+
|
512
|
+
<div class="method_details ">
|
513
|
+
<h3 class="signature " id="configure-instance_method">
|
514
|
+
|
515
|
+
#<strong>configure</strong>(opts = nil) ⇒ <tt>Object</tt>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</h3><div class="docstring">
|
522
|
+
<div class="discussion">
|
523
|
+
|
524
|
+
<p>Configure through hash</p>
|
525
|
+
|
526
|
+
|
527
|
+
</div>
|
528
|
+
</div>
|
529
|
+
<div class="tags">
|
530
|
+
|
531
|
+
|
532
|
+
</div><table class="source_code">
|
533
|
+
<tr>
|
534
|
+
<td>
|
535
|
+
<pre class="lines">
|
536
|
+
|
537
|
+
|
538
|
+
27
|
539
|
+
28
|
540
|
+
29
|
541
|
+
30
|
542
|
+
31
|
543
|
+
32
|
544
|
+
33
|
545
|
+
34
|
546
|
+
35
|
547
|
+
36
|
548
|
+
37
|
549
|
+
38
|
550
|
+
39
|
551
|
+
40
|
552
|
+
41
|
553
|
+
42</pre>
|
554
|
+
</td>
|
555
|
+
<td>
|
556
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 27</span>
|
557
|
+
|
558
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_configure'>configure</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
559
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
560
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</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>
|
561
|
+
<span class='kw'>if</span> <span class='ivar'>@valid_config_keys</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
562
|
+
<span class='ivar'>@config</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
563
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_k'>k</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
564
|
+
<span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Valid key words are follows:</span><span class='tstring_end'>"</span></span>
|
565
|
+
<span class='id identifier rubyid_p'>p</span> <span class='ivar'>@valid_config_keys</span>
|
566
|
+
<span class='kw'>else</span>
|
567
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>KeyError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error: keyword '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>' is invalid</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
568
|
+
<span class='label'>receiver:</span> <span class='ivar'>@config</span><span class='comma'>,</span>
|
569
|
+
<span class='label'>key:</span> <span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
|
570
|
+
<span class='kw'>end</span>
|
571
|
+
<span class='kw'>end</span>
|
572
|
+
<span class='ivar'>@config</span>
|
573
|
+
<span class='kw'>end</span></pre>
|
574
|
+
</td>
|
575
|
+
</tr>
|
576
|
+
</table>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
<div class="method_details ">
|
580
|
+
<h3 class="signature " id="configure_with-instance_method">
|
581
|
+
|
582
|
+
#<strong>configure_with</strong>(path) ⇒ <tt>Object</tt>
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
</h3><div class="docstring">
|
589
|
+
<div class="discussion">
|
590
|
+
|
591
|
+
<p>Configure through yaml file</p>
|
592
|
+
|
593
|
+
|
594
|
+
</div>
|
595
|
+
</div>
|
596
|
+
<div class="tags">
|
597
|
+
|
598
|
+
|
599
|
+
</div><table class="source_code">
|
600
|
+
<tr>
|
601
|
+
<td>
|
602
|
+
<pre class="lines">
|
603
|
+
|
604
|
+
|
605
|
+
45
|
606
|
+
46
|
607
|
+
47
|
608
|
+
48
|
609
|
+
49
|
610
|
+
50
|
611
|
+
51
|
612
|
+
52
|
613
|
+
53
|
614
|
+
54
|
615
|
+
55
|
616
|
+
56
|
617
|
+
57</pre>
|
618
|
+
</td>
|
619
|
+
<td>
|
620
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 45</span>
|
621
|
+
|
622
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_configure_with'>configure_with</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
623
|
+
<span class='kw'>begin</span>
|
624
|
+
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_safe_load'>safe_load</span><span class='lparen'>(</span><span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='comma'>,</span>
|
625
|
+
<span class='label'>permitted_classes:</span> <span class='lbracket'>[</span><span class='const'>Symbol</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
626
|
+
<span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>ENOENT</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
627
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>WARNING: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>.\nUsing default conf.</span><span class='tstring_end'>"</span></span>
|
628
|
+
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_message'>message</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:verbose</span><span class='rbracket'>]</span>
|
629
|
+
<span class='kw'>rescue</span> <span class='const'>Psych</span><span class='op'>::</span><span class='const'>SyntaxError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
630
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>WARNING: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>.\nUsing default conf.</span><span class='tstring_end'>"</span></span>
|
631
|
+
<span class='gvar'>$stderr</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_message'>message</span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:verbose</span><span class='rbracket'>]</span>
|
632
|
+
<span class='kw'>end</span>
|
633
|
+
<span class='id identifier rubyid_configure'>configure</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
634
|
+
<span class='kw'>end</span></pre>
|
635
|
+
</td>
|
636
|
+
</tr>
|
637
|
+
</table>
|
638
|
+
</div>
|
639
|
+
|
640
|
+
<div class="method_details ">
|
641
|
+
<h3 class="signature " id="save_config-instance_method">
|
642
|
+
|
643
|
+
#<strong>save_config</strong> ⇒ <tt>Object</tt>
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
</h3><div class="docstring">
|
650
|
+
<div class="discussion">
|
651
|
+
|
652
|
+
<p>save config in @<a href=":conf_file">config</a></p>
|
653
|
+
|
654
|
+
|
655
|
+
</div>
|
656
|
+
</div>
|
657
|
+
<div class="tags">
|
658
|
+
|
659
|
+
|
660
|
+
</div><table class="source_code">
|
661
|
+
<tr>
|
662
|
+
<td>
|
663
|
+
<pre class="lines">
|
664
|
+
|
665
|
+
|
666
|
+
60
|
667
|
+
61
|
668
|
+
62</pre>
|
669
|
+
</td>
|
670
|
+
<td>
|
671
|
+
<pre class="code"><span class="info file"># File 'lib/my_help/config.rb', line 60</span>
|
672
|
+
|
673
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_save_config'>save_config</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
674
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:conf_file</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
675
|
+
<span class='kw'>end</span></pre>
|
676
|
+
</td>
|
677
|
+
</tr>
|
678
|
+
</table>
|
679
|
+
</div>
|
680
|
+
|
681
|
+
</div>
|
682
|
+
|
683
|
+
</div>
|
684
|
+
|
685
|
+
<div id="footer">
|
686
|
+
Generated on Thu Sep 26 14:20:52 2024 by
|
687
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
688
|
+
0.9.36 (ruby-3.0.2).
|
689
|
+
</div>
|
690
|
+
|
691
|
+
</div>
|
692
|
+
</body>
|
693
|
+
</html>
|