simple-service 0.1.5 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +10 -2
  3. data/Gemfile +3 -1
  4. data/Makefile +5 -2
  5. data/TODO.txt +3 -0
  6. data/VERSION +1 -1
  7. data/doc/Simple/Service/Action/Comment/Extractor.html +1 -1
  8. data/doc/Simple/Service/Action/Comment.html +1 -1
  9. data/doc/Simple/Service/Action/MethodReflection.html +1 -1
  10. data/doc/Simple/Service/Action/Parameter.html +2 -2
  11. data/doc/Simple/Service/Action.html +59 -150
  12. data/doc/Simple/Service/ArgumentError.html +1 -1
  13. data/doc/Simple/Service/ClassMethods.html +5 -5
  14. data/doc/Simple/Service/Context.html +5 -5
  15. data/doc/Simple/Service/ContextMissingError.html +1 -1
  16. data/doc/Simple/Service/ContextReadOnlyError.html +1 -1
  17. data/doc/Simple/Service/ExtraArguments.html +1 -1
  18. data/doc/Simple/Service/GemHelper.html +1 -1
  19. data/doc/Simple/Service/MissingArguments.html +1 -1
  20. data/doc/Simple/Service/NoSuchAction.html +1 -1
  21. data/doc/Simple/Service.html +89 -87
  22. data/doc/Simple.html +1 -1
  23. data/doc/_index.html +7 -19
  24. data/doc/class_list.html +1 -1
  25. data/doc/file.README.html +3 -3
  26. data/doc/file.TODO.html +70 -0
  27. data/doc/file_list.html +5 -0
  28. data/doc/index.html +3 -3
  29. data/doc/method_list.html +59 -115
  30. data/doc/top-level-namespace.html +1 -1
  31. data/lib/simple/service/action/comment.rb +1 -1
  32. data/lib/simple/service/action.rb +10 -3
  33. data/lib/simple/service/errors.rb +4 -3
  34. data/lib/simple/service.rb +33 -28
  35. data/lib/simple/workflow/context.rb +105 -0
  36. data/lib/simple/workflow/current_context.rb +33 -0
  37. data/lib/simple/workflow/reloader.rb +84 -0
  38. data/lib/simple/workflow/rspec_helper.rb +15 -0
  39. data/lib/simple/workflow.rb +96 -0
  40. data/lib/simple-workflow.rb +3 -0
  41. data/scripts/test +2 -0
  42. data/simple-service.gemspec +1 -0
  43. data/spec/simple/service/action_invoke3_spec.rb +0 -8
  44. data/spec/simple/service/action_invoke_spec.rb +82 -20
  45. data/spec/simple/service/service_spec.rb +13 -56
  46. data/spec/simple/workflow/context_spec.rb +90 -0
  47. data/spec/simple/workflow/current_context_spec.rb +41 -0
  48. data/spec/simple/workflow/reloader_spec/example1.rb +10 -0
  49. data/spec/simple/workflow/reloader_spec/example2.rb +7 -0
  50. data/spec/simple/workflow/reloader_spec.rb +48 -0
  51. data/spec/spec_helper.rb +2 -1
  52. data/spec/support/spec_services.rb +1 -3
  53. metadata +42 -7
  54. data/doc/Simple/Service/Action/IndieHash.html +0 -506
  55. data/lib/simple/service/context.rb +0 -94
  56. data/spec/simple/service/context_spec.rb +0 -69
data/doc/index.html CHANGED
@@ -111,7 +111,7 @@
111
111
  <p>If the calling site, however, has <strong>named arguments</strong> (in a Hash), one would invoke a service using <code>invoke2</code>. This is used for HTTPD integration (with <code>simple-httpd</code>.)</p>
112
112
 
113
113
  <pre class="code ruby"><code class="ruby"> <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>My Universe</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>c:</span> <span class='int'>299792458</span><span class='rbrace'>}</span>
114
- <span class='const'><span class='object_link'><a href="Simple.html" title="Simple (module)">Simple</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Simple/Service.html" title="Simple::Service (module)">Service</a></span></span><span class='period'>.</span><span class='id identifier rubyid_invoke2'><span class='object_link'><a href="Simple/Service.html#invoke2-class_method" title="Simple::Service.invoke2 (method)">invoke2</a></span></span> <span class='const'>GodMode</span><span class='comma'>,</span>
114
+ <span class='const'><span class='object_link'><a href="Simple.html" title="Simple (module)">Simple</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Simple/Service.html" title="Simple::Service (module)">Service</a></span></span><span class='period'>.</span><span class='id identifier rubyid_invoke2'>invoke2</span> <span class='const'>GodMode</span><span class='comma'>,</span>
115
115
  <span class='symbol'>:build_universe</span><span class='comma'>,</span>
116
116
  <span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span>
117
117
  </code></pre>
@@ -122,7 +122,7 @@
122
122
 
123
123
  <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="Simple.html" title="Simple (module)">Simple</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Simple/Service.html" title="Simple::Service (module)">Service</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with_context'><span class='object_link'><a href="Simple/Service.html#with_context-class_method" title="Simple::Service.with_context (method)">with_context</a></span></span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>do</span>
124
124
  <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>My Universe</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>c:</span> <span class='int'>299792458</span><span class='rbrace'>}</span>
125
- <span class='const'><span class='object_link'><a href="Simple.html" title="Simple (module)">Simple</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Simple/Service.html" title="Simple::Service (module)">Service</a></span></span><span class='period'>.</span><span class='id identifier rubyid_invoke2'><span class='object_link'><a href="Simple/Service.html#invoke2-class_method" title="Simple::Service.invoke2 (method)">invoke2</a></span></span> <span class='const'>GodMode</span><span class='comma'>,</span>
125
+ <span class='const'><span class='object_link'><a href="Simple.html" title="Simple (module)">Simple</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Simple/Service.html" title="Simple::Service (module)">Service</a></span></span><span class='period'>.</span><span class='id identifier rubyid_invoke2'>invoke2</span> <span class='const'>GodMode</span><span class='comma'>,</span>
126
126
  <span class='symbol'>:build_universe</span><span class='comma'>,</span>
127
127
  <span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span>
128
128
  <span class='kw'>end</span>
@@ -136,7 +136,7 @@
136
136
  </div></div>
137
137
 
138
138
  <div id="footer">
139
- Generated on Tue Dec 3 13:46:26 2019 by
139
+ Generated on Wed Dec 4 22:57:12 2019 by
140
140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
141
141
  0.9.20 (ruby-2.5.1).
142
142
  </div>
data/doc/method_list.html CHANGED
@@ -46,24 +46,24 @@
46
46
 
47
47
  <li class="odd ">
48
48
  <div class="item">
49
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#[]-instance_method" title="Simple::Service::Action::IndieHash#[] (method)">#[]</a></span>
50
- <small>Simple::Service::Action::IndieHash</small>
49
+ <span class='object_link'><a href="Simple/Service/ClassMethods.html#__simple_service_actions__-instance_method" title="Simple::Service::ClassMethods#__simple_service_actions__ (method)">#__simple_service_actions__</a></span>
50
+ <small>Simple::Service::ClassMethods</small>
51
51
  </div>
52
52
  </li>
53
53
 
54
54
 
55
55
  <li class="even ">
56
56
  <div class="item">
57
- <span class='object_link'><a href="Simple/Service/ClassMethods.html#__simple_service_actions__-instance_method" title="Simple::Service::ClassMethods#__simple_service_actions__ (method)">#__simple_service_actions__</a></span>
58
- <small>Simple::Service::ClassMethods</small>
57
+ <span class='object_link'><a href="Simple/Service/Action/Comment/Extractor.html#_parse_source-instance_method" title="Simple::Service::Action::Comment::Extractor#_parse_source (method)">#_parse_source</a></span>
58
+ <small>Simple::Service::Action::Comment::Extractor</small>
59
59
  </div>
60
60
  </li>
61
61
 
62
62
 
63
63
  <li class="odd ">
64
64
  <div class="item">
65
- <span class='object_link'><a href="Simple/Service/Action/Comment/Extractor.html#_parse_source-instance_method" title="Simple::Service::Action::Comment::Extractor#_parse_source (method)">#_parse_source</a></span>
66
- <small>Simple::Service::Action::Comment::Extractor</small>
65
+ <span class='object_link'><a href="Simple/Service/ExtraArguments.html#action-instance_method" title="Simple::Service::ExtraArguments#action (method)">#action</a></span>
66
+ <small>Simple::Service::ExtraArguments</small>
67
67
  </div>
68
68
  </li>
69
69
 
@@ -85,14 +85,6 @@
85
85
 
86
86
 
87
87
  <li class="even ">
88
- <div class="item">
89
- <span class='object_link'><a href="Simple/Service/ExtraArguments.html#action-instance_method" title="Simple::Service::ExtraArguments#action (method)">#action</a></span>
90
- <small>Simple::Service::ExtraArguments</small>
91
- </div>
92
- </li>
93
-
94
-
95
- <li class="odd ">
96
88
  <div class="item">
97
89
  <span class='object_link'><a href="Simple/Service.html#actions-class_method" title="Simple::Service.actions (method)">actions</a></span>
98
90
  <small>Simple::Service</small>
@@ -100,7 +92,7 @@
100
92
  </li>
101
93
 
102
94
 
103
- <li class="even ">
95
+ <li class="odd ">
104
96
  <div class="item">
105
97
  <span class='object_link'><a href="Simple/Service/ExtraArguments.html#arguments-instance_method" title="Simple::Service::ExtraArguments#arguments (method)">#arguments</a></span>
106
98
  <small>Simple::Service::ExtraArguments</small>
@@ -108,7 +100,7 @@
108
100
  </li>
109
101
 
110
102
 
111
- <li class="odd ">
103
+ <li class="even ">
112
104
  <div class="item">
113
105
  <span class='object_link'><a href="Simple/Service.html#context-class_method" title="Simple::Service.context (method)">context</a></span>
114
106
  <small>Simple::Service</small>
@@ -116,7 +108,7 @@
116
108
  </li>
117
109
 
118
110
 
119
- <li class="even ">
111
+ <li class="odd ">
120
112
  <div class="item">
121
113
  <span class='object_link'><a href="Simple/Service/Action/Parameter.html#default_value-instance_method" title="Simple::Service::Action::Parameter#default_value (method)">#default_value</a></span>
122
114
  <small>Simple::Service::Action::Parameter</small>
@@ -124,7 +116,7 @@
124
116
  </li>
125
117
 
126
118
 
127
- <li class="odd ">
119
+ <li class="even ">
128
120
  <div class="item">
129
121
  <span class='object_link'><a href="Simple/Service/Action.html#enumerate-class_method" title="Simple::Service::Action.enumerate (method)">enumerate</a></span>
130
122
  <small>Simple::Service::Action</small>
@@ -132,7 +124,7 @@
132
124
  </li>
133
125
 
134
126
 
135
- <li class="even ">
127
+ <li class="odd ">
136
128
  <div class="item">
137
129
  <span class='object_link'><a href="Simple/Service/Action/Comment.html#extract-class_method" title="Simple::Service::Action::Comment.extract (method)">extract</a></span>
138
130
  <small>Simple::Service::Action::Comment</small>
@@ -140,7 +132,7 @@
140
132
  </li>
141
133
 
142
134
 
143
- <li class="odd ">
135
+ <li class="even ">
144
136
  <div class="item">
145
137
  <span class='object_link'><a href="Simple/Service/Action/Comment/Extractor.html#extract_comment_lines-instance_method" title="Simple::Service::Action::Comment::Extractor#extract_comment_lines (method)">#extract_comment_lines</a></span>
146
138
  <small>Simple::Service::Action::Comment::Extractor</small>
@@ -148,14 +140,6 @@
148
140
  </li>
149
141
 
150
142
 
151
- <li class="even ">
152
- <div class="item">
153
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#fetch_values-instance_method" title="Simple::Service::Action::IndieHash#fetch_values (method)">#fetch_values</a></span>
154
- <small>Simple::Service::Action::IndieHash</small>
155
- </div>
156
- </li>
157
-
158
-
159
143
  <li class="odd ">
160
144
  <div class="item">
161
145
  <span class='object_link'><a href="Simple/Service/Action/Comment.html#full-instance_method" title="Simple::Service::Action::Comment#full (method)">#full</a></span>
@@ -190,32 +174,32 @@
190
174
 
191
175
  <li class="odd ">
192
176
  <div class="item">
193
- <span class='object_link'><a href="Simple/Service/ContextReadOnlyError.html#initialize-instance_method" title="Simple::Service::ContextReadOnlyError#initialize (method)">#initialize</a></span>
194
- <small>Simple::Service::ContextReadOnlyError</small>
177
+ <span class='object_link'><a href="Simple/Service/Action.html#initialize-instance_method" title="Simple::Service::Action#initialize (method)">#initialize</a></span>
178
+ <small>Simple::Service::Action</small>
195
179
  </div>
196
180
  </li>
197
181
 
198
182
 
199
183
  <li class="even ">
200
184
  <div class="item">
201
- <span class='object_link'><a href="Simple/Service/NoSuchAction.html#initialize-instance_method" title="Simple::Service::NoSuchAction#initialize (method)">#initialize</a></span>
202
- <small>Simple::Service::NoSuchAction</small>
185
+ <span class='object_link'><a href="Simple/Service/Action/Comment.html#initialize-instance_method" title="Simple::Service::Action::Comment#initialize (method)">#initialize</a></span>
186
+ <small>Simple::Service::Action::Comment</small>
203
187
  </div>
204
188
  </li>
205
189
 
206
190
 
207
191
  <li class="odd ">
208
192
  <div class="item">
209
- <span class='object_link'><a href="Simple/Service/Action/Comment.html#initialize-instance_method" title="Simple::Service::Action::Comment#initialize (method)">#initialize</a></span>
210
- <small>Simple::Service::Action::Comment</small>
193
+ <span class='object_link'><a href="Simple/Service/Action/Parameter.html#initialize-instance_method" title="Simple::Service::Action::Parameter#initialize (method)">#initialize</a></span>
194
+ <small>Simple::Service::Action::Parameter</small>
211
195
  </div>
212
196
  </li>
213
197
 
214
198
 
215
199
  <li class="even ">
216
200
  <div class="item">
217
- <span class='object_link'><a href="Simple/Service/MissingArguments.html#initialize-instance_method" title="Simple::Service::MissingArguments#initialize (method)">#initialize</a></span>
218
- <small>Simple::Service::MissingArguments</small>
201
+ <span class='object_link'><a href="Simple/Service/ContextReadOnlyError.html#initialize-instance_method" title="Simple::Service::ContextReadOnlyError#initialize (method)">#initialize</a></span>
202
+ <small>Simple::Service::ContextReadOnlyError</small>
219
203
  </div>
220
204
  </li>
221
205
 
@@ -230,37 +214,29 @@
230
214
 
231
215
  <li class="even ">
232
216
  <div class="item">
233
- <span class='object_link'><a href="Simple/Service/Context.html#initialize-instance_method" title="Simple::Service::Context#initialize (method)">#initialize</a></span>
234
- <small>Simple::Service::Context</small>
217
+ <span class='object_link'><a href="Simple/Service/NoSuchAction.html#initialize-instance_method" title="Simple::Service::NoSuchAction#initialize (method)">#initialize</a></span>
218
+ <small>Simple::Service::NoSuchAction</small>
235
219
  </div>
236
220
  </li>
237
221
 
238
222
 
239
223
  <li class="odd ">
240
224
  <div class="item">
241
- <span class='object_link'><a href="Simple/Service/Action.html#initialize-instance_method" title="Simple::Service::Action#initialize (method)">#initialize</a></span>
242
- <small>Simple::Service::Action</small>
225
+ <span class='object_link'><a href="Simple/Service/MissingArguments.html#initialize-instance_method" title="Simple::Service::MissingArguments#initialize (method)">#initialize</a></span>
226
+ <small>Simple::Service::MissingArguments</small>
243
227
  </div>
244
228
  </li>
245
229
 
246
230
 
247
231
  <li class="even ">
248
232
  <div class="item">
249
- <span class='object_link'><a href="Simple/Service/Action/Parameter.html#initialize-instance_method" title="Simple::Service::Action::Parameter#initialize (method)">#initialize</a></span>
250
- <small>Simple::Service::Action::Parameter</small>
233
+ <span class='object_link'><a href="Simple/Service/Context.html#initialize-instance_method" title="Simple::Service::Context#initialize (method)">#initialize</a></span>
234
+ <small>Simple::Service::Context</small>
251
235
  </div>
252
236
  </li>
253
237
 
254
238
 
255
239
  <li class="odd ">
256
- <div class="item">
257
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#initialize-instance_method" title="Simple::Service::Action::IndieHash#initialize (method)">#initialize</a></span>
258
- <small>Simple::Service::Action::IndieHash</small>
259
- </div>
260
- </li>
261
-
262
-
263
- <li class="even ">
264
240
  <div class="item">
265
241
  <span class='object_link'><a href="Simple/Service.html#invoke-class_method" title="Simple::Service.invoke (method)">invoke</a></span>
266
242
  <small>Simple::Service</small>
@@ -268,17 +244,9 @@
268
244
  </li>
269
245
 
270
246
 
271
- <li class="odd ">
272
- <div class="item">
273
- <span class='object_link'><a href="Simple/Service/Action.html#invoke-instance_method" title="Simple::Service::Action#invoke (method)">#invoke</a></span>
274
- <small>Simple::Service::Action</small>
275
- </div>
276
- </li>
277
-
278
-
279
247
  <li class="even ">
280
248
  <div class="item">
281
- <span class='object_link'><a href="Simple/Service/Action.html#invoke2-instance_method" title="Simple::Service::Action#invoke2 (method)">#invoke2</a></span>
249
+ <span class='object_link'><a href="Simple/Service/Action.html#invoke-instance_method" title="Simple::Service::Action#invoke (method)">#invoke</a></span>
282
250
  <small>Simple::Service::Action</small>
283
251
  </div>
284
252
  </li>
@@ -286,28 +254,12 @@
286
254
 
287
255
  <li class="odd ">
288
256
  <div class="item">
289
- <span class='object_link'><a href="Simple/Service.html#invoke2-class_method" title="Simple::Service.invoke2 (method)">invoke2</a></span>
257
+ <span class='object_link'><a href="Simple/Service.html#invoke3-class_method" title="Simple::Service.invoke3 (method)">invoke3</a></span>
290
258
  <small>Simple::Service</small>
291
259
  </div>
292
260
  </li>
293
261
 
294
262
 
295
- <li class="even ">
296
- <div class="item">
297
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#key%3F-instance_method" title="Simple::Service::Action::IndieHash#key? (method)">#key?</a></span>
298
- <small>Simple::Service::Action::IndieHash</small>
299
- </div>
300
- </li>
301
-
302
-
303
- <li class="odd ">
304
- <div class="item">
305
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#keys-instance_method" title="Simple::Service::Action::IndieHash#keys (method)">#keys</a></span>
306
- <small>Simple::Service::Action::IndieHash</small>
307
- </div>
308
- </li>
309
-
310
-
311
263
  <li class="even ">
312
264
  <div class="item">
313
265
  <span class='object_link'><a href="Simple/Service/Action/Parameter.html#keyword%3F-instance_method" title="Simple::Service::Action::Parameter#keyword? (method)">#keyword?</a></span>
@@ -326,40 +278,40 @@
326
278
 
327
279
  <li class="even ">
328
280
  <div class="item">
329
- <span class='object_link'><a href="Simple/Service/Action/IndieHash.html#merge-instance_method" title="Simple::Service::Action::IndieHash#merge (method)">#merge</a></span>
330
- <small>Simple::Service::Action::IndieHash</small>
281
+ <span class='object_link'><a href="Simple/Service/Context.html#merge-instance_method" title="Simple::Service::Context#merge (method)">#merge</a></span>
282
+ <small>Simple::Service::Context</small>
331
283
  </div>
332
284
  </li>
333
285
 
334
286
 
335
287
  <li class="odd ">
336
288
  <div class="item">
337
- <span class='object_link'><a href="Simple/Service/Context.html#merge-instance_method" title="Simple::Service::Context#merge (method)">#merge</a></span>
338
- <small>Simple::Service::Context</small>
289
+ <span class='object_link'><a href="Simple/Service/Action.html#name-instance_method" title="Simple::Service::Action#name (method)">#name</a></span>
290
+ <small>Simple::Service::Action</small>
339
291
  </div>
340
292
  </li>
341
293
 
342
294
 
343
295
  <li class="even ">
344
296
  <div class="item">
345
- <span class='object_link'><a href="Simple/Service/Action/Parameter.html#name-instance_method" title="Simple::Service::Action::Parameter#name (method)">#name</a></span>
346
- <small>Simple::Service::Action::Parameter</small>
297
+ <span class='object_link'><a href="Simple/Service/NoSuchAction.html#name-instance_method" title="Simple::Service::NoSuchAction#name (method)">#name</a></span>
298
+ <small>Simple::Service::NoSuchAction</small>
347
299
  </div>
348
300
  </li>
349
301
 
350
302
 
351
303
  <li class="odd ">
352
304
  <div class="item">
353
- <span class='object_link'><a href="Simple/Service/Action.html#name-instance_method" title="Simple::Service::Action#name (method)">#name</a></span>
354
- <small>Simple::Service::Action</small>
305
+ <span class='object_link'><a href="Simple/Service/Action/Parameter.html#name-instance_method" title="Simple::Service::Action::Parameter#name (method)">#name</a></span>
306
+ <small>Simple::Service::Action::Parameter</small>
355
307
  </div>
356
308
  </li>
357
309
 
358
310
 
359
311
  <li class="even ">
360
312
  <div class="item">
361
- <span class='object_link'><a href="Simple/Service/NoSuchAction.html#name-instance_method" title="Simple::Service::NoSuchAction#name (method)">#name</a></span>
362
- <small>Simple::Service::NoSuchAction</small>
313
+ <span class='object_link'><a href="Simple/Service/Action/MethodReflection.html#parameters-instance_method" title="Simple::Service::Action::MethodReflection#parameters (method)">#parameters</a></span>
314
+ <small>Simple::Service::Action::MethodReflection</small>
363
315
  </div>
364
316
  </li>
365
317
 
@@ -374,31 +326,31 @@
374
326
 
375
327
  <li class="even ">
376
328
  <div class="item">
377
- <span class='object_link'><a href="Simple/Service/Action/MethodReflection.html#parameters-instance_method" title="Simple::Service::Action::MethodReflection#parameters (method)">#parameters</a></span>
378
- <small>Simple::Service::Action::MethodReflection</small>
329
+ <span class='object_link'><a href="Simple/Service/Action.html#parameters-instance_method" title="Simple::Service::Action#parameters (method)">#parameters</a></span>
330
+ <small>Simple::Service::Action</small>
379
331
  </div>
380
332
  </li>
381
333
 
382
334
 
383
335
  <li class="odd ">
384
336
  <div class="item">
385
- <span class='object_link'><a href="Simple/Service/Action.html#parameters-instance_method" title="Simple::Service::Action#parameters (method)">#parameters</a></span>
386
- <small>Simple::Service::Action</small>
337
+ <span class='object_link'><a href="Simple/Service/Action/Comment/Extractor.html#parse_source-instance_method" title="Simple::Service::Action::Comment::Extractor#parse_source (method)">#parse_source</a></span>
338
+ <small>Simple::Service::Action::Comment::Extractor</small>
387
339
  </div>
388
340
  </li>
389
341
 
390
342
 
391
343
  <li class="even ">
392
344
  <div class="item">
393
- <span class='object_link'><a href="Simple/Service/Action/Comment/Extractor.html#parse_source-instance_method" title="Simple::Service::Action::Comment::Extractor#parse_source (method)">#parse_source</a></span>
394
- <small>Simple::Service::Action::Comment::Extractor</small>
345
+ <span class='object_link'><a href="Simple/Service/Action/Parameter.html#positional%3F-instance_method" title="Simple::Service::Action::Parameter#positional? (method)">#positional?</a></span>
346
+ <small>Simple::Service::Action::Parameter</small>
395
347
  </div>
396
348
  </li>
397
349
 
398
350
 
399
351
  <li class="odd ">
400
352
  <div class="item">
401
- <span class='object_link'><a href="Simple/Service/Action/Parameter.html#positional%3F-instance_method" title="Simple::Service::Action::Parameter#positional? (method)">#positional?</a></span>
353
+ <span class='object_link'><a href="Simple/Service/Action/Parameter.html#reflect_on_method-class_method" title="Simple::Service::Action::Parameter.reflect_on_method (method)">reflect_on_method</a></span>
402
354
  <small>Simple::Service::Action::Parameter</small>
403
355
  </div>
404
356
  </li>
@@ -406,7 +358,7 @@
406
358
 
407
359
  <li class="even ">
408
360
  <div class="item">
409
- <span class='object_link'><a href="Simple/Service/Action/Parameter.html#reflect_on_method-class_method" title="Simple::Service::Action::Parameter.reflect_on_method (method)">reflect_on_method</a></span>
361
+ <span class='object_link'><a href="Simple/Service/Action/Parameter.html#required%3F-instance_method" title="Simple::Service::Action::Parameter#required? (method)">#required?</a></span>
410
362
  <small>Simple::Service::Action::Parameter</small>
411
363
  </div>
412
364
  </li>
@@ -414,8 +366,8 @@
414
366
 
415
367
  <li class="odd ">
416
368
  <div class="item">
417
- <span class='object_link'><a href="Simple/Service/Action/Parameter.html#required%3F-instance_method" title="Simple::Service::Action::Parameter#required? (method)">#required?</a></span>
418
- <small>Simple::Service::Action::Parameter</small>
369
+ <span class='object_link'><a href="Simple/Service/Action.html#service-instance_method" title="Simple::Service::Action#service (method)">#service</a></span>
370
+ <small>Simple::Service::Action</small>
419
371
  </div>
420
372
  </li>
421
373
 
@@ -430,31 +382,31 @@
430
382
 
431
383
  <li class="odd ">
432
384
  <div class="item">
433
- <span class='object_link'><a href="Simple/Service/Action.html#service-instance_method" title="Simple::Service::Action#service (method)">#service</a></span>
434
- <small>Simple::Service::Action</small>
385
+ <span class='object_link'><a href="Simple/Service.html#service%3F-class_method" title="Simple::Service.service? (method)">service?</a></span>
386
+ <small>Simple::Service</small>
435
387
  </div>
436
388
  </li>
437
389
 
438
390
 
439
391
  <li class="even ">
440
392
  <div class="item">
441
- <span class='object_link'><a href="Simple/Service.html#service%3F-class_method" title="Simple::Service.service? (method)">service?</a></span>
442
- <small>Simple::Service</small>
393
+ <span class='object_link'><a href="Simple/Service/Action/Comment.html#short-instance_method" title="Simple::Service::Action::Comment#short (method)">#short</a></span>
394
+ <small>Simple::Service::Action::Comment</small>
443
395
  </div>
444
396
  </li>
445
397
 
446
398
 
447
399
  <li class="odd ">
448
400
  <div class="item">
449
- <span class='object_link'><a href="Simple/Service/Action/Comment.html#short-instance_method" title="Simple::Service::Action::Comment#short (method)">#short</a></span>
450
- <small>Simple::Service::Action::Comment</small>
401
+ <span class='object_link'><a href="Simple/Service/Action.html#short_description-instance_method" title="Simple::Service::Action#short_description (method)">#short_description</a></span>
402
+ <small>Simple::Service::Action</small>
451
403
  </div>
452
404
  </li>
453
405
 
454
406
 
455
407
  <li class="even ">
456
408
  <div class="item">
457
- <span class='object_link'><a href="Simple/Service/Action.html#short_description-instance_method" title="Simple::Service::Action#short_description (method)">#short_description</a></span>
409
+ <span class='object_link'><a href="Simple/Service/Action.html#source_location-instance_method" title="Simple::Service::Action#source_location (method)">#source_location</a></span>
458
410
  <small>Simple::Service::Action</small>
459
411
  </div>
460
412
  </li>
@@ -462,7 +414,7 @@
462
414
 
463
415
  <li class="odd ">
464
416
  <div class="item">
465
- <span class='object_link'><a href="Simple/Service/Action.html#source_location-instance_method" title="Simple::Service::Action#source_location (method)">#source_location</a></span>
417
+ <span class='object_link'><a href="Simple/Service/Action.html#to_s-instance_method" title="Simple::Service::Action#to_s (method)">#to_s</a></span>
466
418
  <small>Simple::Service::Action</small>
467
419
  </div>
468
420
  </li>
@@ -493,14 +445,6 @@
493
445
 
494
446
 
495
447
  <li class="odd ">
496
- <div class="item">
497
- <span class='object_link'><a href="Simple/Service/Action.html#to_s-instance_method" title="Simple::Service::Action#to_s (method)">#to_s</a></span>
498
- <small>Simple::Service::Action</small>
499
- </div>
500
- </li>
501
-
502
-
503
- <li class="even ">
504
448
  <div class="item">
505
449
  <span class='object_link'><a href="Simple/Service/Action/Parameter.html#variadic%3F-instance_method" title="Simple::Service::Action::Parameter#variadic? (method)">#variadic?</a></span>
506
450
  <small>Simple::Service::Action::Parameter</small>
@@ -508,7 +452,7 @@
508
452
  </li>
509
453
 
510
454
 
511
- <li class="odd ">
455
+ <li class="even ">
512
456
  <div class="item">
513
457
  <span class='object_link'><a href="Simple/Service.html#verify_service!-class_method" title="Simple::Service.verify_service! (method)">verify_service!</a></span>
514
458
  <small>Simple::Service</small>
@@ -516,7 +460,7 @@
516
460
  </li>
517
461
 
518
462
 
519
- <li class="even ">
463
+ <li class="odd ">
520
464
  <div class="item">
521
465
  <span class='object_link'><a href="Simple/Service/GemHelper.html#version-instance_method" title="Simple::Service::GemHelper#version (method)">#version</a></span>
522
466
  <small>Simple::Service::GemHelper</small>
@@ -524,7 +468,7 @@
524
468
  </li>
525
469
 
526
470
 
527
- <li class="odd ">
471
+ <li class="even ">
528
472
  <div class="item">
529
473
  <span class='object_link'><a href="Simple/Service.html#with_context-class_method" title="Simple::Service.with_context (method)">with_context</a></span>
530
474
  <small>Simple::Service</small>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Tue Dec 3 13:46:26 2019 by
103
+ Generated on Wed Dec 4 22:57:12 2019 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.20 (ruby-2.5.1).
106
106
  </div>
@@ -6,7 +6,7 @@ class ::Simple::Service::Action::Comment # @private
6
6
  def self.extract(action:)
7
7
  file, line = action.source_location
8
8
  lines = Extractor.extract_comment_lines(file: file, before_line: line)
9
- full = lines[2..-1].join("\n") if lines.length >= 2
9
+ full = lines[2..].join("\n") if lines.length >= 2
10
10
  new short: lines[0], full: full
11
11
  end
12
12
 
@@ -1,4 +1,5 @@
1
1
  module Simple::Service
2
+ # rubocop:disable Lint/EmptyClass
2
3
  class Action
3
4
  end
4
5
  end
@@ -80,6 +81,12 @@ module Simple::Service
80
81
  positionals = build_positional_arguments(args, flags)
81
82
  keywords = build_keyword_arguments(args.merge(flags))
82
83
 
84
+ # check for extra flags
85
+ extra_flags = (flags.keys - keywords.keys.map(&:to_s)).map { |flag| "--#{flag}" }
86
+ unless extra_flags.empty?
87
+ raise Simple::Service::ArgumentError, "Unknown flag(s): #{extra_flags.join(", ")}."
88
+ end
89
+
83
90
  service_instance = Object.new
84
91
  service_instance.extend service
85
92
 
@@ -114,7 +121,7 @@ module Simple::Service
114
121
 
115
122
  # Note that +keys+ now only contains names of keyword arguments that actually exist.
116
123
  # This is therefore not a way to DOS this process.
117
- Hash[keys.map(&:to_sym).zip(values)]
124
+ keys.map(&:to_sym).zip(values).to_h
118
125
  end
119
126
 
120
127
  def variadic_parameter
@@ -164,7 +171,7 @@ module Simple::Service
164
171
  # we otherwise raise a ExtraArguments exception.
165
172
  case ary.length <=> positional_names.length
166
173
  when 1 # i.e. ary.length > positional_names.length
167
- extra_arguments = ary[positional_names.length..-1]
174
+ extra_arguments = ary[positional_names.length..]
168
175
  ary = ary[0..positional_names.length]
169
176
 
170
177
  if !extra_arguments.empty? && !variadic_parameter
@@ -179,7 +186,7 @@ module Simple::Service
179
186
  end
180
187
 
181
188
  # Build a hash with the existing_positional_names and the values from the array.
182
- hsh = Hash[existing_positional_names.zip(ary)]
189
+ hsh = existing_positional_names.zip(ary).to_h
183
190
 
184
191
  # Add the variadic_parameter, if any.
185
192
  hsh[variadic_parameter.name] = extra_arguments if variadic_parameter
@@ -2,8 +2,10 @@ module Simple::Service
2
2
  # Will be raised by ::Simple::Service.action.
3
3
  class NoSuchAction < ::ArgumentError
4
4
  attr_reader :service, :name
5
+
5
6
  def initialize(service, name)
6
7
  @service, @name = service, name
8
+ super()
7
9
  end
8
10
 
9
11
  def to_s
@@ -22,6 +24,7 @@ module Simple::Service
22
24
 
23
25
  def initialize(action, parameters)
24
26
  @action, @parameters = action, parameters
27
+ super()
25
28
  end
26
29
 
27
30
  def to_s
@@ -35,6 +38,7 @@ module Simple::Service
35
38
 
36
39
  def initialize(action, arguments)
37
40
  @action, @arguments = action, arguments
41
+ super()
38
42
  end
39
43
 
40
44
  def to_s
@@ -43,9 +47,6 @@ module Simple::Service
43
47
  end
44
48
  end
45
49
 
46
- class ContextMissingError < ::StandardError
47
- end
48
-
49
50
  class ContextReadOnlyError < ::StandardError
50
51
  def initialize(key)
51
52
  super "Cannot overwrite existing context setting #{key.inspect}"