simple-service 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11f94dc8ace9fd802e2070599093e8032a83d68ae448b67cd8daddd9c3ff0d99
4
- data.tar.gz: 71d8c154622760417f1afb7c036e1c185da50a072604e23a08b08cbb70631c2c
3
+ metadata.gz: 903d43626ea1853a44478fd58d6aef0a4e86374745e9a5732e127ab85fcd4437
4
+ data.tar.gz: ed5f2caa57468945b72bcf805c0ff3e2afd7df654ea03387a59fa16ea136ad19
5
5
  SHA512:
6
- metadata.gz: 8cce4acded3ec3adb8e58c2dab41a91f7b19b6dba24d3cae68f4954e18b55ab0eb798d7865a3689d64194baa7fc31e2fd40df8aa7e6abb2ecc35fc26dc762734
7
- data.tar.gz: 90f763056b319c7cd45030a3f76ae18e672972ff40905408a930c84dbe1410ebdadc3cd710b04a388ad3309080db3be717b9bd3f08e6ea515301db3e77bb0d3d
6
+ metadata.gz: 0ab49e773b69b41e844a73da66f7ab06ca90f0d4edc097a4d44bc8457272040acd428fc37e3128a6e662f18bab30fb6d0e8a396c40eed6eccb2dd316171c5b1a
7
+ data.tar.gz: b06385441ec3d0ce87aba8095e30cb7ab07f871c6507ae133b611eab0f370458c378d5f1ffd27111221b3ca75096ca0ff41bc1c6b61ab1f40cfebe45b1a5ac81
@@ -98,3 +98,6 @@ Style/DoubleNegation:
98
98
 
99
99
  Style/ParallelAssignment:
100
100
  Enabled: false
101
+
102
+ Style/CommentedKeyword:
103
+ Enabled: false
data/Makefile CHANGED
@@ -4,6 +4,9 @@ test:
4
4
  rspec
5
5
 
6
6
  .PHONY: doc
7
- doc:
7
+ doc: todo
8
8
  rm -rf doc/*
9
- yard doc -o doc
9
+ yard doc -o doc - TODO.txt
10
+
11
+ todo:
12
+ lentil . -f comp | tee TODO.txt
@@ -0,0 +1,3 @@
1
+ lib/simple/service.rb:39:
2
+ why a Hash? It feels much better if Simple::Service.actions returns an array of names.
3
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Tue Dec 3 13:46:26 2019 by
110
+ Generated on Wed Dec 4 22:57:12 2019 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.9.20 (ruby-2.5.1).
113
113
  </div>
@@ -88,7 +88,7 @@
88
88
  <h2>Overview</h2><div class="docstring">
89
89
  <div class="discussion">
90
90
 
91
- <p>The <strong>Simple::Service</strong> interface</p>
91
+ <p><strong>The Simple::Service interface</strong></p>
92
92
 
93
93
  <p>This module implements the main API of the Simple::Service ruby gem.</p>
94
94
  <ol><li>
@@ -109,16 +109,19 @@
109
109
  <span class='kw'>end</span>
110
110
  </code></pre>
111
111
  </li><li>
112
- <p><em>Discover services:</em> To discover services in a service module use the #actions method. This returns a Hash of actions. [TODO] why a Hash?</p>
112
+ <p><em>Discover services:</em> To discover services in a service module use the #actions method. This returns a Hash of actions. </p>
113
113
 
114
114
  <pre class="code ruby"><code class="ruby">Simple::Service.actions(GodMode)
115
115
  =&gt; {:build_universe=&gt;#&lt;Simple::Service::Action...&gt;, ...}
116
116
  </code></pre>
117
- </li><li>
118
- <p><em>Invoke a service:</em> run <code>Simple::Service.invoke</code> or <code>Simple::Service.invoke2</code>. You must set a context first. </p>
117
+ </li></ol>
118
+
119
+ <p>TODO: why a Hash? It feels much better if Simple::Service.actions returns an array of names.</p>
120
+ <ol><li>
121
+ <p><em>Invoke a service:</em> run <code>Simple::Service.invoke3</code> or <code>Simple::Service.invoke</code>. You must set a context first.</p>
119
122
 
120
123
  <pre class="code ruby"><code class="ruby">Simple::Service.with_context do
121
- Simple::Service.invoke(GodMode, :build_universe, &quot;TestWorld&quot;, c: 1e9)
124
+ Simple::Service.invoke3(GodMode, :build_universe, &quot;TestWorld&quot;, c: 1e9)
122
125
  end
123
126
  =&gt; 42
124
127
  </code></pre>
@@ -270,7 +273,7 @@ end
270
273
  <li class="public ">
271
274
  <span class="summary_signature">
272
275
 
273
- <a href="#invoke-class_method" title="invoke (class method)">.<strong>invoke</strong>(service, name, *args, **named_args) &#x21d2; Object </a>
276
+ <a href="#invoke-class_method" title="invoke (class method)">.<strong>invoke</strong>(service, name, args: {}, flags: {}) &#x21d2; Object </a>
274
277
 
275
278
 
276
279
 
@@ -285,7 +288,7 @@ end
285
288
 
286
289
 
287
290
  <span class="summary_desc"><div class='inline'>
288
- <p>invokes an action with a given <code>name</code> in a service with <code>arguments</code> and <code>params</code>.</p>
291
+ <p><strong>Note:</strong> You cannot call this method if the context is not set.</p>
289
292
  </div></span>
290
293
 
291
294
  </li>
@@ -294,7 +297,7 @@ end
294
297
  <li class="public ">
295
298
  <span class="summary_signature">
296
299
 
297
- <a href="#invoke2-class_method" title="invoke2 (class method)">.<strong>invoke2</strong>(service, name, args: {}, flags: {}) &#x21d2; Object </a>
300
+ <a href="#invoke3-class_method" title="invoke3 (class method)">.<strong>invoke3</strong>(service, name, *args, **flags) &#x21d2; Object </a>
298
301
 
299
302
 
300
303
 
@@ -309,7 +312,7 @@ end
309
312
 
310
313
 
311
314
  <span class="summary_desc"><div class='inline'>
312
- <p>invokes an action with a given <code>name</code> in a service with a Hash of arguments.</p>
315
+ <p>invokes an action with a given <code>name</code> in a service with <code>args</code> and <code>flags</code>.</p>
313
316
  </div></span>
314
317
 
315
318
  </li>
@@ -356,7 +359,9 @@ end
356
359
 
357
360
 
358
361
 
359
- <span class="summary_desc"><div class='inline'></div></span>
362
+ <span class="summary_desc"><div class='inline'>
363
+ <p>Raises an error if the passed in object is not a service.</p>
364
+ </div></span>
360
365
 
361
366
  </li>
362
367
 
@@ -420,15 +425,15 @@ end
420
425
  <pre class="lines">
421
426
 
422
427
 
423
- 69
424
- 70
425
- 71
426
- 72
427
- 73
428
- 74</pre>
428
+ 78
429
+ 79
430
+ 80
431
+ 81
432
+ 82
433
+ 83</pre>
429
434
  </td>
430
435
  <td>
431
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 69</span>
436
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 78</span>
432
437
 
433
438
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
434
439
  <span class='id identifier rubyid_actions'>actions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_actions'>actions</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
@@ -467,14 +472,14 @@ end
467
472
  <pre class="lines">
468
473
 
469
474
 
470
- 62
471
- 63
472
- 64
473
- 65
474
- 66</pre>
475
+ 71
476
+ 72
477
+ 73
478
+ 74
479
+ 75</pre>
475
480
  </td>
476
481
  <td>
477
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 62</span>
482
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 71</span>
478
483
 
479
484
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_actions'>actions</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
480
485
  <span class='id identifier rubyid_verify_service!'>verify_service!</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
@@ -542,12 +547,12 @@ end
542
547
  <pre class="lines">
543
548
 
544
549
 
545
- 47
546
- 48
547
- 49</pre>
550
+ 50
551
+ 51
552
+ 52</pre>
548
553
  </td>
549
554
  <td>
550
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 47</span>
555
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 50</span>
551
556
 
552
557
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span> <span class='comment'># @private
553
558
  </span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span> <span class='const'><span class='object_link'><a href="Service/ClassMethods.html" title="Simple::Service::ClassMethods (module)">ClassMethods</a></span></span>
@@ -560,7 +565,7 @@ end
560
565
  <div class="method_details ">
561
566
  <h3 class="signature " id="invoke-class_method">
562
567
 
563
- .<strong>invoke</strong>(service, name, *args, **named_args) &#x21d2; <tt>Object</tt>
568
+ .<strong>invoke</strong>(service, name, args: {}, flags: {}) &#x21d2; <tt>Object</tt>
564
569
 
565
570
 
566
571
 
@@ -569,17 +574,7 @@ end
569
574
  </h3><div class="docstring">
570
575
  <div class="discussion">
571
576
 
572
- <p>invokes an action with a given <code>name</code> in a service with <code>arguments</code> and <code>params</code>.</p>
573
-
574
- <p>You cannot call this method if the context is not set.</p>
575
-
576
- <p>When calling #invoke using positional arguments they will be matched against positional arguments of the invoked method - but they will not be matched against named arguments.</p>
577
-
578
- <p>When there are not enough positional arguments to match the number of required positional arguments of the method we raise an ArgumentError.</p>
579
-
580
- <p>When there are more positional arguments provided than the number accepted by the method we raise an ArgumentError.</p>
581
-
582
- <p>Entries in the named_args Hash that are not defined in the action itself are ignored.</p>
577
+ <p><strong>Note:</strong> You cannot call this method if the context is not set.</p>
583
578
 
584
579
 
585
580
  </div>
@@ -606,19 +601,27 @@ end
606
601
  <pre class="lines">
607
602
 
608
603
 
609
- 91
610
- 92
611
- 93
612
- 94
613
- 95</pre>
604
+ 141
605
+ 142
606
+ 143
607
+ 144
608
+ 145
609
+ 146
610
+ 147
611
+ 148
612
+ 149</pre>
614
613
  </td>
615
614
  <td>
616
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 91</span>
615
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 141</span>
616
+
617
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
618
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="Service/ContextMissingError.html" title="Simple::Service::ContextMissingError (class)">ContextMissingError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Need to set context before calling ::Simple::Service.invoke3</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_context'>context</span>
617
619
 
618
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_named_args'>named_args</span><span class='rparen'>)</span>
619
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="Service/ContextMissingError.html" title="Simple::Service::ContextMissingError (class)">ContextMissingError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Need to set context before calling ::Simple::Service.invoke</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_context'>context</span>
620
+ <span class='id identifier rubyid_expect!'>expect!</span> <span class='id identifier rubyid_args'>args</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='const'>Hash</span><span class='comma'>,</span> <span class='const'>Array</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='const'>Hash</span>
621
+ <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_expect!'>expect!</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=&gt;</span> <span class='const'>String</span> <span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
622
+ <span class='id identifier rubyid_flags'>flags</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_expect!'>expect!</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=&gt;</span> <span class='const'>String</span> <span class='rbrace'>}</span>
620
623
 
621
- <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_named_args'>named_args</span><span class='rparen'>)</span>
624
+ <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='id identifier rubyid_flags'>flags</span><span class='rparen'>)</span>
622
625
  <span class='kw'>end</span></pre>
623
626
  </td>
624
627
  </tr>
@@ -626,9 +629,9 @@ end
626
629
  </div>
627
630
 
628
631
  <div class="method_details ">
629
- <h3 class="signature " id="invoke2-class_method">
632
+ <h3 class="signature " id="invoke3-class_method">
630
633
 
631
- .<strong>invoke2</strong>(service, name, args: {}, flags: {}) &#x21d2; <tt>Object</tt>
634
+ .<strong>invoke3</strong>(service, name, *args, **flags) &#x21d2; <tt>Object</tt>
632
635
 
633
636
 
634
637
 
@@ -637,28 +640,19 @@ end
637
640
  </h3><div class="docstring">
638
641
  <div class="discussion">
639
642
 
640
- <p>invokes an action with a given <code>name</code> in a service with a Hash of arguments.</p>
643
+ <p>invokes an action with a given <code>name</code> in a service with <code>args</code> and <code>flags</code>.</p>
644
+
645
+ <p>This is a helper method which one can use to easily call an action from ruby source code.</p>
646
+
647
+ <p>As the main purpose of this module is to call services with outside data, the <code>.invoke</code> action is usually preferred.</p>
641
648
 
642
- <p>You cannot call this method if the context is not set.</p>
649
+ <p><strong>Note:</strong> You cannot call this method if the context is not set.</p>
643
650
 
644
651
 
645
652
  </div>
646
653
  </div>
647
654
  <div class="tags">
648
655
 
649
- <p class="tag_title">Raises:</p>
650
- <ul class="raise">
651
-
652
- <li>
653
-
654
-
655
- <span class='type'>(<tt><span class='object_link'><a href="Service/ContextMissingError.html" title="Simple::Service::ContextMissingError (class)">ContextMissingError</a></span></tt>)</span>
656
-
657
-
658
-
659
- </li>
660
-
661
- </ul>
662
656
 
663
657
  </div><table class="source_code">
664
658
  <tr>
@@ -666,19 +660,17 @@ end
666
660
  <pre class="lines">
667
661
 
668
662
 
669
- 100
670
- 101
671
- 102
672
- 103
673
- 104</pre>
663
+ 94
664
+ 95
665
+ 96
666
+ 97</pre>
674
667
  </td>
675
668
  <td>
676
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 100</span>
669
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 94</span>
677
670
 
678
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_invoke2'>invoke2</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
679
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="Service/ContextMissingError.html" title="Simple::Service::ContextMissingError (class)">ContextMissingError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Need to set context before calling ::Simple::Service.invoke</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_context'>context</span>
680
-
681
- <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_invoke2'>invoke2</span><span class='lparen'>(</span><span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='id identifier rubyid_flags'>flags</span><span class='rparen'>)</span>
671
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_invoke3'>invoke3</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_flags'>flags</span><span class='rparen'>)</span>
672
+ <span class='id identifier rubyid_flags'>flags</span> <span class='op'>=</span> <span class='id identifier rubyid_flags'>flags</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_hsh'>hsh</span><span class='op'>|</span> <span class='id identifier rubyid_hsh'>hsh</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
673
+ <span class='id identifier rubyid_invoke'>invoke</span> <span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>args:</span> <span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='id identifier rubyid_flags'>flags</span>
682
674
  <span class='kw'>end</span></pre>
683
675
  </td>
684
676
  </tr>
@@ -699,6 +691,8 @@ end
699
691
 
700
692
  <p>returns true if the passed in object is a service module.</p>
701
693
 
694
+ <p>A service must be a module, and it must include the Simple::Service module.</p>
695
+
702
696
 
703
697
  </div>
704
698
  </div>
@@ -724,15 +718,21 @@ end
724
718
  <pre class="lines">
725
719
 
726
720
 
727
- 52
728
- 53
729
- 54</pre>
721
+ 57
722
+ 58
723
+ 59
724
+ 60
725
+ 61
726
+ 62</pre>
730
727
  </td>
731
728
  <td>
732
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 52</span>
729
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 57</span>
733
730
 
734
731
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_service?'>service?</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
735
- <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Module</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
732
+ <span class='id identifier rubyid_verify_service!'>verify_service!</span> <span class='id identifier rubyid_service'>service</span>
733
+ <span class='kw'>true</span>
734
+ <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>ArgumentError</span>
735
+ <span class='kw'>false</span>
736
736
  <span class='kw'>end</span></pre>
737
737
  </td>
738
738
  </tr>
@@ -751,6 +751,8 @@ end
751
751
  </h3><div class="docstring">
752
752
  <div class="discussion">
753
753
 
754
+ <p>Raises an error if the passed in object is not a service</p>
755
+
754
756
 
755
757
  </div>
756
758
  </div>
@@ -776,17 +778,17 @@ end
776
778
  <pre class="lines">
777
779
 
778
780
 
779
- 56
780
- 57
781
- 58
782
- 59</pre>
781
+ 65
782
+ 66
783
+ 67
784
+ 68</pre>
783
785
  </td>
784
786
  <td>
785
- <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 56</span>
787
+ <pre class="code"><span class="info file"># File 'lib/simple/service.rb', line 65</span>
786
788
 
787
789
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_verify_service!'>verify_service!</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span> <span class='comment'># @private
788
790
  </span> <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must be a Simple::Service, but is not even a Module</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Module</span><span class='rparen'>)</span>
789
- <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must be a Simple::Service, did you &#39;include Simple::Service&#39;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_service?'>service?</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
791
+ <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must be a Simple::Service, did you &#39;include Simple::Service&#39;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
790
792
  <span class='kw'>end</span></pre>
791
793
  </td>
792
794
  </tr>
@@ -853,7 +855,7 @@ end
853
855
  </div>
854
856
 
855
857
  <div id="footer">
856
- Generated on Tue Dec 3 13:46:26 2019 by
858
+ Generated on Wed Dec 4 22:57:13 2019 by
857
859
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
858
860
  0.9.20 (ruby-2.5.1).
859
861
  </div>
@@ -95,7 +95,7 @@
95
95
  <dl>
96
96
  <dt>Defined in:</dt>
97
97
  <dd>lib/simple/service/action.rb<span class="defines">,<br />
98
- lib/simple/service/action.rb,<br /> lib/simple/service/action/indie_hash.rb</span>
98
+ lib/simple/service/action.rb</span>
99
99
  </dd>
100
100
  </dl>
101
101
 
@@ -104,7 +104,7 @@
104
104
  <h2>Overview</h2><div class="docstring">
105
105
  <div class="discussion">
106
106
 
107
- <p>rubocop:disable Metrics/AbcSize rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Style/GuardClause rubocop:disable Metrics/ClassLength</p>
107
+ <p>rubocop:disable Metrics/AbcSize rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/ClassLength</p>
108
108
 
109
109
 
110
110
  </div>
@@ -120,7 +120,7 @@
120
120
 
121
121
 
122
122
 
123
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Action/Comment.html" title="Simple::Service::Action::Comment (class)">Comment</a></span>, <span class='object_link'><a href="Action/IndieHash.html" title="Simple::Service::Action::IndieHash (class)">IndieHash</a></span>, <span class='object_link'><a href="Action/Parameter.html" title="Simple::Service::Action::Parameter (class)">Parameter</a></span>
123
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Action/Comment.html" title="Simple::Service::Action::Comment (class)">Comment</a></span>, <span class='object_link'><a href="Action/Parameter.html" title="Simple::Service::Action::Parameter (class)">Parameter</a></span>
124
124
 
125
125
 
126
126
  </p>
@@ -329,31 +329,7 @@
329
329
  <li class="public ">
330
330
  <span class="summary_signature">
331
331
 
332
- <a href="#invoke-instance_method" title="#invoke (instance method)">#<strong>invoke</strong>(*args, **named_args) &#x21d2; Object </a>
333
-
334
-
335
-
336
- </span>
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
- <span class="summary_desc"><div class='inline'>
347
- <p>build a service_instance and run the action, with arguments constructed from args_hsh and params_hsh.</p>
348
- </div></span>
349
-
350
- </li>
351
-
352
-
353
- <li class="public ">
354
- <span class="summary_signature">
355
-
356
- <a href="#invoke2-instance_method" title="#invoke2 (instance method)">#<strong>invoke2</strong>(args:, flags:) &#x21d2; Object </a>
332
+ <a href="#invoke-instance_method" title="#invoke (instance method)">#<strong>invoke</strong>(args:, flags:) &#x21d2; Object </a>
357
333
 
358
334
 
359
335
 
@@ -496,15 +472,15 @@
496
472
  <pre class="lines">
497
473
 
498
474
 
475
+ 42
476
+ 43
499
477
  44
500
478
  45
501
479
  46
502
- 47
503
- 48
504
- 49</pre>
480
+ 47</pre>
505
481
  </td>
506
482
  <td>
507
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 44</span>
483
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 42</span>
508
484
 
509
485
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='comment'># @private
510
486
  </span> <span class='ivar'>@service</span> <span class='op'>=</span> <span class='id identifier rubyid_service'>service</span>
@@ -550,12 +526,12 @@
550
526
  <pre class="lines">
551
527
 
552
528
 
553
- 29
554
- 30
555
- 31</pre>
529
+ 27
530
+ 28
531
+ 29</pre>
556
532
  </td>
557
533
  <td>
558
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 29</span>
534
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 27</span>
559
535
 
560
536
  <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
561
537
  <span class='ivar'>@name</span>
@@ -593,12 +569,12 @@
593
569
  <pre class="lines">
594
570
 
595
571
 
596
- 28
597
- 29
598
- 30</pre>
572
+ 26
573
+ 27
574
+ 28</pre>
599
575
  </td>
600
576
  <td>
601
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 28</span>
577
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 26</span>
602
578
 
603
579
  <span class='kw'>def</span> <span class='id identifier rubyid_service'>service</span>
604
580
  <span class='ivar'>@service</span>
@@ -641,14 +617,14 @@
641
617
  <pre class="lines">
642
618
 
643
619
 
620
+ 20
621
+ 21
644
622
  22
645
623
  23
646
- 24
647
- 25
648
- 26</pre>
624
+ 24</pre>
649
625
  </td>
650
626
  <td>
651
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 22</span>
627
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 20</span>
652
628
 
653
629
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enumerate'>enumerate</span><span class='lparen'>(</span><span class='label'>service:</span><span class='rparen'>)</span> <span class='comment'># @private
654
630
  </span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_public_instance_methods'>public_instance_methods</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span>
@@ -681,12 +657,12 @@
681
657
  <pre class="lines">
682
658
 
683
659
 
684
- 55
685
- 56
686
- 57</pre>
660
+ 53
661
+ 54
662
+ 55</pre>
687
663
  </td>
688
664
  <td>
689
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 55</span>
665
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 53</span>
690
666
 
691
667
  <span class='kw'>def</span> <span class='id identifier rubyid_full_description'>full_description</span>
692
668
  <span class='id identifier rubyid_comment'>comment</span><span class='period'>.</span><span class='id identifier rubyid_full'>full</span>
@@ -711,12 +687,12 @@
711
687
  <pre class="lines">
712
688
 
713
689
 
714
- 31
715
- 32
716
- 33</pre>
690
+ 29
691
+ 30
692
+ 31</pre>
717
693
  </td>
718
694
  <td>
719
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 31</span>
695
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 29</span>
720
696
 
721
697
  <span class='kw'>def</span> <span class='id identifier rubyid_full_name'>full_name</span>
722
698
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
@@ -729,7 +705,7 @@
729
705
  <div class="method_details ">
730
706
  <h3 class="signature " id="invoke-instance_method">
731
707
 
732
- #<strong>invoke</strong>(*args, **named_args) &#x21d2; <tt>Object</tt>
708
+ #<strong>invoke</strong>(args:, flags:) &#x21d2; <tt>Object</tt>
733
709
 
734
710
 
735
711
 
@@ -738,7 +714,9 @@
738
714
  </h3><div class="docstring">
739
715
  <div class="discussion">
740
716
 
741
- <p>build a service_instance and run the action, with arguments constructed from args_hsh and params_hsh.</p>
717
+ <p>invokes an action with a given <code>name</code> in a service with a Hash of arguments.</p>
718
+
719
+ <p>You cannot call this method if the context is not set.</p>
742
720
 
743
721
 
744
722
  </div>
@@ -752,6 +730,7 @@
752
730
  <pre class="lines">
753
731
 
754
732
 
733
+ 75
755
734
  76
756
735
  77
757
736
  78
@@ -763,89 +742,19 @@
763
742
  84
764
743
  85
765
744
  86
766
- 87</pre>
767
- </td>
768
- <td>
769
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 76</span>
770
-
771
- <span class='kw'>def</span> <span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_named_args'>named_args</span><span class='rparen'>)</span>
772
- <span class='comment'># convert Array arguments into a Hash of named arguments. This is strictly
773
- </span> <span class='comment'># necessary to be able to apply default value-based type conversions. (On
774
- </span> <span class='comment'># the downside this also means we convert an array to a hash and then back
775
- </span> <span class='comment'># into an array. This, however, should only be an issue for CLI based action
776
- </span> <span class='comment'># invocations, because any other use case (that I can think of) should allow
777
- </span> <span class='comment'># us to provide arguments as a Hash.
778
- </span> <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='id identifier rubyid_convert_argument_array_to_hash'>convert_argument_array_to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
779
- <span class='id identifier rubyid_named_args'>named_args</span> <span class='op'>=</span> <span class='id identifier rubyid_named_args'>named_args</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
780
-
781
- <span class='id identifier rubyid_invoke2'>invoke2</span><span class='lparen'>(</span><span class='label'>args:</span> <span class='id identifier rubyid_named_args'>named_args</span><span class='comma'>,</span> <span class='label'>flags:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
782
- <span class='kw'>end</span></pre>
783
- </td>
784
- </tr>
785
- </table>
786
- </div>
787
-
788
- <div class="method_details ">
789
- <h3 class="signature " id="invoke2-instance_method">
790
-
791
- #<strong>invoke2</strong>(args:, flags:) &#x21d2; <tt>Object</tt>
792
-
793
-
794
-
795
-
796
-
797
- </h3><div class="docstring">
798
- <div class="discussion">
799
-
800
- <p>invokes an action with a given <code>name</code> in a service with a Hash of arguments.</p>
801
-
802
- <p>You cannot call this method if the context is not set.</p>
803
-
804
-
805
- </div>
806
- </div>
807
- <div class="tags">
808
-
809
-
810
- </div><table class="source_code">
811
- <tr>
812
- <td>
813
- <pre class="lines">
814
-
815
-
745
+ 87
746
+ 88
747
+ 89
748
+ 90
749
+ 91
816
750
  92
817
- 93
818
- 94
819
- 95
820
- 96
821
- 97
822
- 98
823
- 99
824
- 100
825
- 101
826
- 102
827
- 103
828
- 104
829
- 105
830
- 106
831
- 107
832
- 108
833
- 109
834
- 110
835
- 111
836
- 112
837
- 113
838
- 114</pre>
751
+ 93</pre>
839
752
  </td>
840
753
  <td>
841
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 92</span>
754
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 75</span>
842
755
 
843
- <span class='kw'>def</span> <span class='id identifier rubyid_invoke2'>invoke2</span><span class='lparen'>(</span><span class='label'>args:</span><span class='comma'>,</span> <span class='label'>flags:</span><span class='rparen'>)</span>
844
- <span class='comment'># args and flags are being stringified. This is necessary to not allow any
845
- </span> <span class='comment'># unchecked input to DOS this process by just providing always changing
846
- </span> <span class='comment'># key values.
847
- </span> <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Action/IndieHash.html" title="Simple::Service::Action::IndieHash (class)">IndieHash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Action/IndieHash.html#initialize-instance_method" title="Simple::Service::Action::IndieHash#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
848
- <span class='id identifier rubyid_flags'>flags</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Action/IndieHash.html" title="Simple::Service::Action::IndieHash (class)">IndieHash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Action/IndieHash.html#initialize-instance_method" title="Simple::Service::Action::IndieHash#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_flags'>flags</span><span class='rparen'>)</span>
756
+ <span class='kw'>def</span> <span class='id identifier rubyid_invoke'>invoke</span><span class='lparen'>(</span><span class='label'>args:</span><span class='comma'>,</span> <span class='label'>flags:</span><span class='rparen'>)</span>
757
+ <span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='id identifier rubyid_convert_argument_array_to_hash'>convert_argument_array_to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
849
758
 
850
759
  <span class='id identifier rubyid_verify_required_args!'>verify_required_args!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='id identifier rubyid_flags'>flags</span><span class='rparen'>)</span>
851
760
 
@@ -894,12 +803,12 @@
894
803
  <pre class="lines">
895
804
 
896
805
 
897
- 40
898
- 41
899
- 42</pre>
806
+ 38
807
+ 39
808
+ 40</pre>
900
809
  </td>
901
810
  <td>
902
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 40</span>
811
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 38</span>
903
812
 
904
813
  <span class='kw'>def</span> <span class='id identifier rubyid_parameters'>parameters</span>
905
814
  <span class='ivar'>@parameters</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Action/Parameter.html" title="Simple::Service::Action::Parameter (class)">Parameter</a></span></span><span class='period'>.</span><span class='id identifier rubyid_reflect_on_method'><span class='object_link'><a href="Action/Parameter.html#reflect_on_method-class_method" title="Simple::Service::Action::Parameter.reflect_on_method (method)">reflect_on_method</a></span></span><span class='lparen'>(</span><span class='label'>service:</span> <span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
@@ -924,12 +833,12 @@
924
833
  <pre class="lines">
925
834
 
926
835
 
927
- 51
928
- 52
929
- 53</pre>
836
+ 49
837
+ 50
838
+ 51</pre>
930
839
  </td>
931
840
  <td>
932
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 51</span>
841
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 49</span>
933
842
 
934
843
  <span class='kw'>def</span> <span class='id identifier rubyid_short_description'>short_description</span>
935
844
  <span class='id identifier rubyid_comment'>comment</span><span class='period'>.</span><span class='id identifier rubyid_short'>short</span>
@@ -954,12 +863,12 @@
954
863
  <pre class="lines">
955
864
 
956
865
 
957
- 70
958
- 71
959
- 72</pre>
866
+ 68
867
+ 69
868
+ 70</pre>
960
869
  </td>
961
870
  <td>
962
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 70</span>
871
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 68</span>
963
872
 
964
873
  <span class='kw'>def</span> <span class='id identifier rubyid_source_location'>source_location</span>
965
874
  <span class='ivar'>@service</span><span class='period'>.</span><span class='id identifier rubyid_instance_method'>instance_method</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_source_location'>source_location</span>
@@ -984,12 +893,12 @@
984
893
  <pre class="lines">
985
894
 
986
895
 
987
- 35
988
- 36
989
- 37</pre>
896
+ 33
897
+ 34
898
+ 35</pre>
990
899
  </td>
991
900
  <td>
992
- <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 35</span>
901
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action.rb', line 33</span>
993
902
 
994
903
  <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span> <span class='comment'># @private
995
904
  </span> <span class='id identifier rubyid_full_name'>full_name</span>
@@ -1004,7 +913,7 @@
1004
913
  </div>
1005
914
 
1006
915
  <div id="footer">
1007
- Generated on Tue Dec 3 13:46:26 2019 by
916
+ Generated on Wed Dec 4 22:57:13 2019 by
1008
917
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1009
918
  0.9.20 (ruby-2.5.1).
1010
919
  </div>