simple-service 0.1.1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.rubocop.yml +7 -0
  4. data/.tm_properties +1 -1
  5. data/Makefile +8 -0
  6. data/README.md +68 -1
  7. data/TODO.txt +3 -0
  8. data/VERSION +1 -1
  9. data/doc/Simple.html +117 -0
  10. data/doc/Simple/Service.html +865 -0
  11. data/doc/Simple/Service/Action.html +923 -0
  12. data/doc/Simple/Service/Action/Comment.html +451 -0
  13. data/doc/Simple/Service/Action/Comment/Extractor.html +347 -0
  14. data/doc/Simple/Service/Action/MethodReflection.html +285 -0
  15. data/doc/Simple/Service/Action/Parameter.html +816 -0
  16. data/doc/Simple/Service/ArgumentError.html +128 -0
  17. data/doc/Simple/Service/ClassMethods.html +187 -0
  18. data/doc/Simple/Service/Context.html +379 -0
  19. data/doc/Simple/Service/ContextMissingError.html +124 -0
  20. data/doc/Simple/Service/ContextReadOnlyError.html +206 -0
  21. data/doc/Simple/Service/ExtraArguments.html +428 -0
  22. data/doc/Simple/Service/GemHelper.html +190 -0
  23. data/doc/Simple/Service/MissingArguments.html +426 -0
  24. data/doc/Simple/Service/NoSuchAction.html +433 -0
  25. data/doc/_index.html +274 -0
  26. data/doc/class_list.html +51 -0
  27. data/doc/css/common.css +1 -0
  28. data/doc/css/full_list.css +58 -0
  29. data/doc/css/style.css +496 -0
  30. data/doc/file.README.html +146 -0
  31. data/doc/file.TODO.html +70 -0
  32. data/doc/file_list.html +61 -0
  33. data/doc/frames.html +17 -0
  34. data/doc/index.html +146 -0
  35. data/doc/js/app.js +303 -0
  36. data/doc/js/full_list.js +216 -0
  37. data/doc/js/jquery.js +4 -0
  38. data/doc/method_list.html +483 -0
  39. data/doc/top-level-namespace.html +110 -0
  40. data/lib/simple/service.rb +161 -56
  41. data/lib/simple/service/action.rb +104 -107
  42. data/lib/simple/service/action/comment.rb +3 -1
  43. data/lib/simple/service/action/method_reflection.rb +3 -3
  44. data/lib/simple/service/action/parameter.rb +3 -7
  45. data/lib/simple/service/context.rb +69 -27
  46. data/lib/simple/service/errors.rb +54 -0
  47. data/lib/simple/service/version.rb +7 -2
  48. data/scripts/stats +2 -1
  49. data/spec/simple/service/action_invoke3_spec.rb +266 -0
  50. data/spec/simple/service/action_invoke_spec.rb +237 -0
  51. data/spec/simple/service/action_spec.rb +51 -0
  52. data/spec/simple/service/context_spec.rb +39 -7
  53. data/spec/simple/service/service_spec.rb +158 -0
  54. data/spec/simple/service/version_spec.rb +7 -0
  55. data/spec/spec_helper.rb +15 -2
  56. data/spec/support/spec_services.rb +58 -0
  57. metadata +48 -6
  58. data/lib/simple.rb +0 -2
  59. data/spec/support/004_simplecov.rb +0 -13
@@ -0,0 +1,451 @@
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: Simple::Service::Action::Comment
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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 = "Simple::Service::Action::Comment";
19
+ relpath = '../../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../../_index.html">Index (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../Simple.html" title="Simple (module)">Simple</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Service.html" title="Simple::Service (module)">Service</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Action.html" title="Simple::Service::Action (class)">Action</a></span></span>
41
+ &raquo;
42
+ <span class="title">Comment</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: Simple::Service::Action::Comment
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">Simple::Service::Action::Comment</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/simple/service/action/comment.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>returns the comment for an action</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div><h2>Defined Under Namespace</h2>
114
+ <p class="children">
115
+
116
+
117
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Comment/Extractor.html" title="Simple::Service::Action::Comment::Extractor (module)">Extractor</a></span>
118
+
119
+
120
+
121
+
122
+ </p>
123
+
124
+
125
+
126
+
127
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
128
+ <ul class="summary">
129
+
130
+ <li class="public ">
131
+ <span class="summary_signature">
132
+
133
+ <a href="#full-instance_method" title="#full (instance method)">#<strong>full</strong> &#x21d2; Object </a>
134
+
135
+
136
+
137
+ </span>
138
+
139
+
140
+
141
+
142
+ <span class="note title readonly">readonly</span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>Returns the value of attribute full.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#short-instance_method" title="#short (instance method)">#<strong>short</strong> &#x21d2; Object </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+
170
+
171
+ <span class="note title readonly">readonly</span>
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+ <span class="summary_desc"><div class='inline'>
182
+ <p>Returns the value of attribute short.</p>
183
+ </div></span>
184
+
185
+ </li>
186
+
187
+
188
+ </ul>
189
+
190
+
191
+
192
+
193
+
194
+ <h2>
195
+ Class Method Summary
196
+ <small><a href="#" class="summary_toggle">collapse</a></small>
197
+ </h2>
198
+
199
+ <ul class="summary">
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#extract-class_method" title="extract (class method)">.<strong>extract</strong>(action:) &#x21d2; 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
+ <h2>
226
+ Instance Method Summary
227
+ <small><a href="#" class="summary_toggle">collapse</a></small>
228
+ </h2>
229
+
230
+ <ul class="summary">
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(short:, full:) &#x21d2; Comment </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+ <span class="note title constructor">constructor</span>
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+ <span class="summary_desc"><div class='inline'>
252
+ <p>A new instance of Comment.</p>
253
+ </div></span>
254
+
255
+ </li>
256
+
257
+
258
+ </ul>
259
+
260
+
261
+ <div id="constructor_details" class="method_details_list">
262
+ <h2>Constructor Details</h2>
263
+
264
+ <div class="method_details first">
265
+ <h3 class="signature first" id="initialize-instance_method">
266
+
267
+ #<strong>initialize</strong>(short:, full:) &#x21d2; <tt><span class='object_link'><a href="" title="Simple::Service::Action::Comment (class)">Comment</a></span></tt>
268
+
269
+
270
+
271
+
272
+
273
+ </h3><div class="docstring">
274
+ <div class="discussion">
275
+
276
+ <p>Returns a new instance of Comment</p>
277
+
278
+
279
+ </div>
280
+ </div>
281
+ <div class="tags">
282
+
283
+
284
+ </div><table class="source_code">
285
+ <tr>
286
+ <td>
287
+ <pre class="lines">
288
+
289
+
290
+ 13
291
+ 14
292
+ 15</pre>
293
+ </td>
294
+ <td>
295
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 13</span>
296
+
297
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>short:</span><span class='comma'>,</span> <span class='label'>full:</span><span class='rparen'>)</span>
298
+ <span class='ivar'>@short</span><span class='comma'>,</span> <span class='ivar'>@full</span> <span class='op'>=</span> <span class='id identifier rubyid_short'>short</span><span class='comma'>,</span> <span class='id identifier rubyid_full'>full</span>
299
+ <span class='kw'>end</span></pre>
300
+ </td>
301
+ </tr>
302
+ </table>
303
+ </div>
304
+
305
+ </div>
306
+
307
+ <div id="instance_attr_details" class="attr_details">
308
+ <h2>Instance Attribute Details</h2>
309
+
310
+
311
+ <span id=""></span>
312
+ <div class="method_details first">
313
+ <h3 class="signature first" id="full-instance_method">
314
+
315
+ #<strong>full</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
316
+
317
+
318
+
319
+
320
+
321
+ </h3><div class="docstring">
322
+ <div class="discussion">
323
+
324
+ <p>Returns the value of attribute full</p>
325
+
326
+
327
+ </div>
328
+ </div>
329
+ <div class="tags">
330
+
331
+
332
+ </div><table class="source_code">
333
+ <tr>
334
+ <td>
335
+ <pre class="lines">
336
+
337
+
338
+ 4
339
+ 5
340
+ 6</pre>
341
+ </td>
342
+ <td>
343
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 4</span>
344
+
345
+ <span class='kw'>def</span> <span class='id identifier rubyid_full'>full</span>
346
+ <span class='ivar'>@full</span>
347
+ <span class='kw'>end</span></pre>
348
+ </td>
349
+ </tr>
350
+ </table>
351
+ </div>
352
+
353
+
354
+ <span id=""></span>
355
+ <div class="method_details ">
356
+ <h3 class="signature " id="short-instance_method">
357
+
358
+ #<strong>short</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
359
+
360
+
361
+
362
+
363
+
364
+ </h3><div class="docstring">
365
+ <div class="discussion">
366
+
367
+ <p>Returns the value of attribute short</p>
368
+
369
+
370
+ </div>
371
+ </div>
372
+ <div class="tags">
373
+
374
+
375
+ </div><table class="source_code">
376
+ <tr>
377
+ <td>
378
+ <pre class="lines">
379
+
380
+
381
+ 3
382
+ 4
383
+ 5</pre>
384
+ </td>
385
+ <td>
386
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 3</span>
387
+
388
+ <span class='kw'>def</span> <span class='id identifier rubyid_short'>short</span>
389
+ <span class='ivar'>@short</span>
390
+ <span class='kw'>end</span></pre>
391
+ </td>
392
+ </tr>
393
+ </table>
394
+ </div>
395
+
396
+ </div>
397
+
398
+
399
+ <div id="class_method_details" class="method_details_list">
400
+ <h2>Class Method Details</h2>
401
+
402
+
403
+ <div class="method_details first">
404
+ <h3 class="signature first" id="extract-class_method">
405
+
406
+ .<strong>extract</strong>(action:) &#x21d2; <tt>Object</tt>
407
+
408
+
409
+
410
+
411
+
412
+ </h3><table class="source_code">
413
+ <tr>
414
+ <td>
415
+ <pre class="lines">
416
+
417
+
418
+ 6
419
+ 7
420
+ 8
421
+ 9
422
+ 10
423
+ 11</pre>
424
+ </td>
425
+ <td>
426
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 6</span>
427
+
428
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_extract'>extract</span><span class='lparen'>(</span><span class='label'>action:</span><span class='rparen'>)</span>
429
+ <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_source_location'>source_location</span>
430
+ <span class='id identifier rubyid_lines'>lines</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Comment/Extractor.html" title="Simple::Service::Action::Comment::Extractor (module)">Extractor</a></span></span><span class='period'>.</span><span class='id identifier rubyid_extract_comment_lines'><span class='object_link'><a href="Comment/Extractor.html#extract_comment_lines-instance_method" title="Simple::Service::Action::Comment::Extractor#extract_comment_lines (method)">extract_comment_lines</a></span></span><span class='lparen'>(</span><span class='label'>file:</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='label'>before_line:</span> <span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
431
+ <span class='id identifier rubyid_full'>full</span> <span class='op'>=</span> <span class='id identifier rubyid_lines'>lines</span><span class='lbracket'>[</span><span class='int'>2</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_lines'>lines</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;=</span> <span class='int'>2</span>
432
+ <span class='id identifier rubyid_new'>new</span> <span class='label'>short:</span> <span class='id identifier rubyid_lines'>lines</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>full:</span> <span class='id identifier rubyid_full'>full</span>
433
+ <span class='kw'>end</span></pre>
434
+ </td>
435
+ </tr>
436
+ </table>
437
+ </div>
438
+
439
+ </div>
440
+
441
+ </div>
442
+
443
+ <div id="footer">
444
+ Generated on Wed Dec 4 22:57:13 2019 by
445
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
446
+ 0.9.20 (ruby-2.5.1).
447
+ </div>
448
+
449
+ </div>
450
+ </body>
451
+ </html>
@@ -0,0 +1,347 @@
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: Simple::Service::Action::Comment::Extractor
8
+
9
+ &mdash; Documentation by YARD 0.9.20
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 = "Simple::Service::Action::Comment::Extractor";
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 (E)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../../Simple.html" title="Simple (module)">Simple</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../../Service.html" title="Simple::Service (module)">Service</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Action.html" title="Simple::Service::Action (class)">Action</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Comment.html" title="Simple::Service::Action::Comment (class)">Comment</a></span></span>
41
+ &raquo;
42
+ <span class="title">Extractor</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: Simple::Service::Action::Comment::Extractor
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+ <dl>
73
+ <dt>Extended by:</dt>
74
+ <dd><span class='object_link'><a href="" title="Simple::Service::Action::Comment::Extractor (module)">Extractor</a></span></dd>
75
+ </dl>
76
+
77
+
78
+
79
+
80
+
81
+
82
+ <dl>
83
+ <dt>Included in:</dt>
84
+ <dd><span class='object_link'><a href="" title="Simple::Service::Action::Comment::Extractor (module)">Extractor</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/simple/service/action/comment.rb</dd>
92
+ </dl>
93
+
94
+ </div>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <h2>
105
+ Instance Method Summary
106
+ <small><a href="#" class="summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <ul class="summary">
110
+
111
+ <li class="public ">
112
+ <span class="summary_signature">
113
+
114
+ <a href="#_parse_source-instance_method" title="#_parse_source (instance method)">#<strong>_parse_source</strong>(file) &#x21d2; Object </a>
115
+
116
+
117
+
118
+ </span>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <span class="summary_desc"><div class='inline'></div></span>
129
+
130
+ </li>
131
+
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#extract_comment_lines-instance_method" title="#extract_comment_lines (instance method)">#<strong>extract_comment_lines</strong>(file:, before_line:) &#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
+ <li class="public ">
156
+ <span class="summary_signature">
157
+
158
+ <a href="#parse_source-instance_method" title="#parse_source (instance method)">#<strong>parse_source</strong>(file) &#x21d2; Object </a>
159
+
160
+
161
+
162
+ </span>
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <span class="summary_desc"><div class='inline'>
173
+ <p>reads the source a file and turns each non-comment into :code and each comment into a string without the leading comment markup.</p>
174
+ </div></span>
175
+
176
+ </li>
177
+
178
+
179
+ </ul>
180
+
181
+
182
+
183
+
184
+ <div id="instance_method_details" class="method_details_list">
185
+ <h2>Instance Method Details</h2>
186
+
187
+
188
+ <div class="method_details first">
189
+ <h3 class="signature first" id="_parse_source-instance_method">
190
+
191
+ #<strong>_parse_source</strong>(file) &#x21d2; <tt>Object</tt>
192
+
193
+
194
+
195
+
196
+
197
+ </h3><table class="source_code">
198
+ <tr>
199
+ <td>
200
+ <pre class="lines">
201
+
202
+
203
+ 27
204
+ 28
205
+ 29
206
+ 30
207
+ 31
208
+ 32
209
+ 33
210
+ 34</pre>
211
+ </td>
212
+ <td>
213
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 27</span>
214
+
215
+ <span class='kw'>def</span> <span class='id identifier rubyid__parse_source'>_parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
216
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readlines'>readlines</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
217
+ <span class='kw'>case</span> <span class='id identifier rubyid_line'>line</span>
218
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*# ?(.*)$</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='backref'>$1</span>
219
+ <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*end</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='symbol'>:end</span>
220
+ <span class='kw'>end</span>
221
+ <span class='kw'>end</span>
222
+ <span class='kw'>end</span></pre>
223
+ </td>
224
+ </tr>
225
+ </table>
226
+ </div>
227
+
228
+ <div class="method_details ">
229
+ <h3 class="signature " id="extract_comment_lines-instance_method">
230
+
231
+ #<strong>extract_comment_lines</strong>(file:, before_line:) &#x21d2; <tt>Object</tt>
232
+
233
+
234
+
235
+
236
+
237
+ </h3><table class="source_code">
238
+ <tr>
239
+ <td>
240
+ <pre class="lines">
241
+
242
+
243
+ 36
244
+ 37
245
+ 38
246
+ 39
247
+ 40
248
+ 41
249
+ 42
250
+ 43
251
+ 44
252
+ 45
253
+ 46
254
+ 47
255
+ 48
256
+ 49
257
+ 50
258
+ 51
259
+ 52
260
+ 53
261
+ 54
262
+ 55</pre>
263
+ </td>
264
+ <td>
265
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 36</span>
266
+
267
+ <span class='kw'>def</span> <span class='id identifier rubyid_extract_comment_lines'>extract_comment_lines</span><span class='lparen'>(</span><span class='label'>file:</span><span class='comma'>,</span> <span class='label'>before_line:</span><span class='rparen'>)</span>
268
+ <span class='id identifier rubyid_parsed_source'>parsed_source</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_source'>parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
269
+
270
+ <span class='comment'># go down from before_line until we see a line which is either a comment
271
+ </span> <span class='comment'># or an :end. Note that the line at before_line-1 should be the first
272
+ </span> <span class='comment'># line of the method definition in question.
273
+ </span> <span class='id identifier rubyid_last_line'>last_line</span> <span class='op'>=</span> <span class='id identifier rubyid_before_line'>before_line</span> <span class='op'>-</span> <span class='int'>1</span>
274
+ <span class='id identifier rubyid_last_line'>last_line</span> <span class='op'>-=</span> <span class='int'>1</span> <span class='kw'>while</span> <span class='id identifier rubyid_last_line'>last_line</span> <span class='op'>&gt;=</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_parsed_source'>parsed_source</span><span class='lbracket'>[</span><span class='id identifier rubyid_last_line'>last_line</span><span class='rbracket'>]</span>
275
+
276
+ <span class='id identifier rubyid_first_line'>first_line</span> <span class='op'>=</span> <span class='id identifier rubyid_last_line'>last_line</span>
277
+ <span class='id identifier rubyid_first_line'>first_line</span> <span class='op'>-=</span> <span class='int'>1</span> <span class='kw'>while</span> <span class='id identifier rubyid_first_line'>first_line</span> <span class='op'>&gt;=</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_parsed_source'>parsed_source</span><span class='lbracket'>[</span><span class='id identifier rubyid_first_line'>first_line</span><span class='rbracket'>]</span>
278
+ <span class='id identifier rubyid_first_line'>first_line</span> <span class='op'>+=</span> <span class='int'>1</span>
279
+
280
+ <span class='id identifier rubyid_comments'>comments</span> <span class='op'>=</span> <span class='id identifier rubyid_parsed_source'>parsed_source</span><span class='lbracket'>[</span><span class='id identifier rubyid_first_line'>first_line</span><span class='op'>..</span><span class='id identifier rubyid_last_line'>last_line</span><span class='rbracket'>]</span>
281
+ <span class='kw'>if</span> <span class='id identifier rubyid_comments'>comments</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:end</span><span class='rparen'>)</span>
282
+ <span class='lbracket'>[</span><span class='rbracket'>]</span>
283
+ <span class='kw'>else</span>
284
+ <span class='id identifier rubyid_parsed_source'>parsed_source</span><span class='lbracket'>[</span><span class='id identifier rubyid_first_line'>first_line</span><span class='op'>..</span><span class='id identifier rubyid_last_line'>last_line</span><span class='rbracket'>]</span>
285
+ <span class='kw'>end</span>
286
+ <span class='kw'>end</span></pre>
287
+ </td>
288
+ </tr>
289
+ </table>
290
+ </div>
291
+
292
+ <div class="method_details ">
293
+ <h3 class="signature " id="parse_source-instance_method">
294
+
295
+ #<strong>parse_source</strong>(file) &#x21d2; <tt>Object</tt>
296
+
297
+
298
+
299
+
300
+
301
+ </h3><div class="docstring">
302
+ <div class="discussion">
303
+
304
+ <p>reads the source a file and turns each non-comment into :code and each comment into a string without the leading comment markup.</p>
305
+
306
+
307
+ </div>
308
+ </div>
309
+ <div class="tags">
310
+
311
+
312
+ </div><table class="source_code">
313
+ <tr>
314
+ <td>
315
+ <pre class="lines">
316
+
317
+
318
+ 22
319
+ 23
320
+ 24
321
+ 25</pre>
322
+ </td>
323
+ <td>
324
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/comment.rb', line 22</span>
325
+
326
+ <span class='kw'>def</span> <span class='id identifier rubyid_parse_source'>parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
327
+ <span class='ivar'>@parsed_sources</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
328
+ <span class='ivar'>@parsed_sources</span><span class='lbracket'>[</span><span class='id identifier rubyid_file'>file</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid__parse_source'>_parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
329
+ <span class='kw'>end</span></pre>
330
+ </td>
331
+ </tr>
332
+ </table>
333
+ </div>
334
+
335
+ </div>
336
+
337
+ </div>
338
+
339
+ <div id="footer">
340
+ Generated on Wed Dec 4 22:57:13 2019 by
341
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
342
+ 0.9.20 (ruby-2.5.1).
343
+ </div>
344
+
345
+ </div>
346
+ </body>
347
+ </html>