simple-service 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rubocop.yml +100 -0
  4. data/.tm_properties +1 -0
  5. data/Gemfile +14 -0
  6. data/Makefile +9 -0
  7. data/README.md +68 -0
  8. data/Rakefile +6 -0
  9. data/VERSION +1 -0
  10. data/bin/bundle +105 -0
  11. data/bin/console +15 -0
  12. data/bin/rake +29 -0
  13. data/bin/rspec +29 -0
  14. data/doc/Simple.html +117 -0
  15. data/doc/Simple/Service.html +863 -0
  16. data/doc/Simple/Service/Action.html +1014 -0
  17. data/doc/Simple/Service/Action/Comment.html +451 -0
  18. data/doc/Simple/Service/Action/Comment/Extractor.html +347 -0
  19. data/doc/Simple/Service/Action/IndieHash.html +506 -0
  20. data/doc/Simple/Service/Action/MethodReflection.html +285 -0
  21. data/doc/Simple/Service/Action/Parameter.html +816 -0
  22. data/doc/Simple/Service/ArgumentError.html +128 -0
  23. data/doc/Simple/Service/ClassMethods.html +187 -0
  24. data/doc/Simple/Service/Context.html +379 -0
  25. data/doc/Simple/Service/ContextMissingError.html +124 -0
  26. data/doc/Simple/Service/ContextReadOnlyError.html +206 -0
  27. data/doc/Simple/Service/ExtraArguments.html +428 -0
  28. data/doc/Simple/Service/GemHelper.html +190 -0
  29. data/doc/Simple/Service/MissingArguments.html +426 -0
  30. data/doc/Simple/Service/NoSuchAction.html +433 -0
  31. data/doc/_index.html +286 -0
  32. data/doc/class_list.html +51 -0
  33. data/doc/css/common.css +1 -0
  34. data/doc/css/full_list.css +58 -0
  35. data/doc/css/style.css +496 -0
  36. data/doc/file.README.html +146 -0
  37. data/doc/file_list.html +56 -0
  38. data/doc/frames.html +17 -0
  39. data/doc/index.html +146 -0
  40. data/doc/js/app.js +303 -0
  41. data/doc/js/full_list.js +216 -0
  42. data/doc/js/jquery.js +4 -0
  43. data/doc/method_list.html +539 -0
  44. data/doc/top-level-namespace.html +110 -0
  45. data/lib/simple-service.rb +3 -0
  46. data/lib/simple/service.rb +143 -0
  47. data/lib/simple/service/action.rb +203 -0
  48. data/lib/simple/service/action/comment.rb +57 -0
  49. data/lib/simple/service/action/indie_hash.rb +37 -0
  50. data/lib/simple/service/action/method_reflection.rb +70 -0
  51. data/lib/simple/service/action/parameter.rb +42 -0
  52. data/lib/simple/service/context.rb +94 -0
  53. data/lib/simple/service/errors.rb +54 -0
  54. data/lib/simple/service/version.rb +29 -0
  55. data/log/.gitkeep +0 -0
  56. data/scripts/release +2 -0
  57. data/scripts/release.rb +91 -0
  58. data/scripts/stats +5 -0
  59. data/scripts/watch +2 -0
  60. data/simple-service.gemspec +25 -0
  61. data/spec/simple/service/action_invoke2_spec.rb +166 -0
  62. data/spec/simple/service/action_invoke_spec.rb +266 -0
  63. data/spec/simple/service/action_spec.rb +51 -0
  64. data/spec/simple/service/context_spec.rb +69 -0
  65. data/spec/simple/service/service_spec.rb +105 -0
  66. data/spec/simple/service/version_spec.rb +7 -0
  67. data/spec/spec_helper.rb +38 -0
  68. data/spec/support/spec_services.rb +50 -0
  69. metadata +130 -0
@@ -0,0 +1,285 @@
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::MethodReflection
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::MethodReflection";
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 (M)</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">MethodReflection</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::MethodReflection
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::MethodReflection (module)">MethodReflection</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::MethodReflection (module)">MethodReflection</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/simple/service/action/method_reflection.rb</dd>
92
+ </dl>
93
+
94
+ </div>
95
+
96
+ <h2>Overview</h2><div class="docstring">
97
+ <div class="discussion">
98
+
99
+ <p>rubocop:disable Metrics/AbcSize</p>
100
+
101
+
102
+ </div>
103
+ </div>
104
+ <div class="tags">
105
+
106
+
107
+ </div>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <h2>
116
+ Instance Method Summary
117
+ <small><a href="#" class="summary_toggle">collapse</a></small>
118
+ </h2>
119
+
120
+ <ul class="summary">
121
+
122
+ <li class="public ">
123
+ <span class="summary_signature">
124
+
125
+ <a href="#parameters-instance_method" title="#parameters (instance method)">#<strong>parameters</strong>(service, method_id) &#x21d2; Object </a>
126
+
127
+
128
+
129
+ </span>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ <span class="summary_desc"><div class='inline'>
140
+ <p>returns an array with entries like the following:.</p>
141
+ </div></span>
142
+
143
+ </li>
144
+
145
+
146
+ </ul>
147
+
148
+
149
+
150
+
151
+ <div id="instance_method_details" class="method_details_list">
152
+ <h2>Instance Method Details</h2>
153
+
154
+
155
+ <div class="method_details first">
156
+ <h3 class="signature first" id="parameters-instance_method">
157
+
158
+ #<strong>parameters</strong>(service, method_id) &#x21d2; <tt>Object</tt>
159
+
160
+
161
+
162
+
163
+
164
+ </h3><div class="docstring">
165
+ <div class="discussion">
166
+
167
+ <p>returns an array with entries like the following:</p>
168
+
169
+ <pre class="code ruby"><code class="ruby">[ :key, name, default_value ]
170
+ [ :keyreq, name [, nil ] ]
171
+ [ :req, name [, nil ] ]
172
+ [ :opt, name [, nil ] ]
173
+ [ :rest, name [, nil ] ]
174
+ </code></pre>
175
+
176
+
177
+ </div>
178
+ </div>
179
+ <div class="tags">
180
+
181
+
182
+ </div><table class="source_code">
183
+ <tr>
184
+ <td>
185
+ <pre class="lines">
186
+
187
+
188
+ 15
189
+ 16
190
+ 17
191
+ 18
192
+ 19
193
+ 20
194
+ 21
195
+ 22
196
+ 23
197
+ 24
198
+ 25
199
+ 26
200
+ 27
201
+ 28
202
+ 29
203
+ 30
204
+ 31
205
+ 32
206
+ 33
207
+ 34
208
+ 35
209
+ 36
210
+ 37
211
+ 38
212
+ 39
213
+ 40
214
+ 41
215
+ 42
216
+ 43
217
+ 44
218
+ 45
219
+ 46
220
+ 47
221
+ 48
222
+ 49
223
+ 50
224
+ 51
225
+ 52</pre>
226
+ </td>
227
+ <td>
228
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/method_reflection.rb', line 15</span>
229
+
230
+ <span class='kw'>def</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='comma'>,</span> <span class='id identifier rubyid_method_id'>method_id</span><span class='rparen'>)</span>
231
+ <span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_service'>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_method_id'>method_id</span><span class='rparen'>)</span>
232
+ <span class='id identifier rubyid_parameters'>parameters</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_parameters'>parameters</span>
233
+
234
+ <span class='comment'># method parameters with a :key mode are optional named arguments. We only
235
+ </span> <span class='comment'># support defaults for those - if there are none we abort here already.
236
+ </span> <span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_mode'>mode</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='op'>|</span> <span class='id identifier rubyid_name'>name</span> <span class='kw'>if</span> <span class='id identifier rubyid_mode'>mode</span> <span class='op'>==</span> <span class='symbol'>:key</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
237
+ <span class='kw'>return</span> <span class='id identifier rubyid_parameters'>parameters</span> <span class='kw'>if</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
238
+
239
+ <span class='comment'># We are now doing a fake call to the method, with a minimal viable set of
240
+ </span> <span class='comment'># arguments, to let the ruby runtime fill in default values for arguments.
241
+ </span> <span class='comment'># We do not, however, let the call complete. Instead we use a TracePoint to
242
+ </span> <span class='comment'># abort as soon as the method is called, and use the its binding to determine
243
+ </span> <span class='comment'># the default values.
244
+ </span>
245
+ <span class='id identifier rubyid_fake_recipient'>fake_recipient</span> <span class='op'>=</span> <span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='id identifier rubyid_service'>service</span><span class='rparen'>)</span>
246
+ <span class='id identifier rubyid_fake_call_args'>fake_call_args</span> <span class='op'>=</span> <span class='id identifier rubyid_minimal_arguments'>minimal_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
247
+
248
+ <span class='id identifier rubyid_trace_point'>trace_point</span> <span class='op'>=</span> <span class='const'>TracePoint</span><span class='period'>.</span><span class='id identifier rubyid_trace'>trace</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tp'>tp</span><span class='op'>|</span>
249
+ <span class='id identifier rubyid_throw'>throw</span> <span class='symbol'>:received_fake_call</span><span class='comma'>,</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_binding'>binding</span> <span class='kw'>if</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_defined_class'>defined_class</span> <span class='op'>==</span> <span class='id identifier rubyid_service'>service</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_method_id'>method_id</span> <span class='op'>==</span> <span class='id identifier rubyid_method_id'>method_id</span>
250
+ <span class='kw'>end</span>
251
+
252
+ <span class='id identifier rubyid_bnd'>bnd</span> <span class='op'>=</span> <span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:received_fake_call</span><span class='rparen'>)</span> <span class='kw'>do</span>
253
+ <span class='id identifier rubyid_fake_recipient'>fake_recipient</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method_id'>method_id</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_fake_call_args'>fake_call_args</span><span class='rparen'>)</span>
254
+ <span class='kw'>end</span>
255
+
256
+ <span class='id identifier rubyid_trace_point'>trace_point</span><span class='period'>.</span><span class='id identifier rubyid_disable'>disable</span>
257
+
258
+ <span class='comment'># extract default values from the received binding, and merge with the
259
+ </span> <span class='comment'># parameters array.
260
+ </span> <span class='id identifier rubyid_default_values'>default_values</span> <span class='op'>=</span> <span class='id identifier rubyid_keys'>keys</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='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key_parameter'>key_parameter</span><span class='comma'>,</span> <span class='id identifier rubyid_hsh'>hsh</span><span class='op'>|</span>
261
+ <span class='id identifier rubyid_hsh'>hsh</span><span class='lbracket'>[</span><span class='id identifier rubyid_key_parameter'>key_parameter</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_bnd'>bnd</span><span class='period'>.</span><span class='id identifier rubyid_local_variable_get'>local_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_key_parameter'>key_parameter</span><span class='rparen'>)</span>
262
+ <span class='kw'>end</span>
263
+
264
+ <span class='id identifier rubyid_parameters'>parameters</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_mode'>mode</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='op'>|</span>
265
+ <span class='lbracket'>[</span><span class='id identifier rubyid_mode'>mode</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_default_values'>default_values</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
266
+ <span class='kw'>end</span>
267
+ <span class='kw'>end</span></pre>
268
+ </td>
269
+ </tr>
270
+ </table>
271
+ </div>
272
+
273
+ </div>
274
+
275
+ </div>
276
+
277
+ <div id="footer">
278
+ Generated on Tue Dec 3 13:46:26 2019 by
279
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
280
+ 0.9.20 (ruby-2.5.1).
281
+ </div>
282
+
283
+ </div>
284
+ </body>
285
+ </html>
@@ -0,0 +1,816 @@
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::Parameter
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::Parameter";
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 (P)</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">Parameter</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::Parameter
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::Parameter</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/parameter.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+
103
+
104
+
105
+
106
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
107
+ <ul class="summary">
108
+
109
+ <li class="public ">
110
+ <span class="summary_signature">
111
+
112
+ <a href="#default_value-instance_method" title="#default_value (instance method)">#<strong>default_value</strong> &#x21d2; Object </a>
113
+
114
+
115
+
116
+ </span>
117
+
118
+
119
+
120
+
121
+ <span class="note title readonly">readonly</span>
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <span class="summary_desc"><div class='inline'>
132
+ <p>The parameter&#39;s default value (if any).</p>
133
+ </div></span>
134
+
135
+ </li>
136
+
137
+
138
+ <li class="public ">
139
+ <span class="summary_signature">
140
+
141
+ <a href="#kind-instance_method" title="#kind (instance method)">#<strong>kind</strong> &#x21d2; Object </a>
142
+
143
+
144
+
145
+ </span>
146
+
147
+
148
+
149
+
150
+ <span class="note title readonly">readonly</span>
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <span class="summary_desc"><div class='inline'>
161
+ <p>Returns the value of attribute kind.</p>
162
+ </div></span>
163
+
164
+ </li>
165
+
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> &#x21d2; Object </a>
171
+
172
+
173
+
174
+ </span>
175
+
176
+
177
+
178
+
179
+ <span class="note title readonly">readonly</span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc"><div class='inline'>
190
+ <p>Returns the value of attribute name.</p>
191
+ </div></span>
192
+
193
+ </li>
194
+
195
+
196
+ </ul>
197
+
198
+
199
+
200
+
201
+
202
+ <h2>
203
+ Class Method Summary
204
+ <small><a href="#" class="summary_toggle">collapse</a></small>
205
+ </h2>
206
+
207
+ <ul class="summary">
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#reflect_on_method-class_method" title="reflect_on_method (class method)">.<strong>reflect_on_method</strong>(service:, name:) &#x21d2; Object </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'></div></span>
227
+
228
+ </li>
229
+
230
+
231
+ </ul>
232
+
233
+ <h2>
234
+ Instance Method Summary
235
+ <small><a href="#" class="summary_toggle">collapse</a></small>
236
+ </h2>
237
+
238
+ <ul class="summary">
239
+
240
+ <li class="public ">
241
+ <span class="summary_signature">
242
+
243
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(kind, name, *default_value) &#x21d2; Parameter </a>
244
+
245
+
246
+
247
+ </span>
248
+
249
+
250
+ <span class="note title constructor">constructor</span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'>
260
+ <p>A new instance of Parameter.</p>
261
+ </div></span>
262
+
263
+ </li>
264
+
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#keyword%3F-instance_method" title="#keyword? (instance method)">#<strong>keyword?</strong> &#x21d2; Boolean </a>
270
+
271
+
272
+
273
+ </span>
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ <span class="summary_desc"><div class='inline'></div></span>
284
+
285
+ </li>
286
+
287
+
288
+ <li class="public ">
289
+ <span class="summary_signature">
290
+
291
+ <a href="#positional%3F-instance_method" title="#positional? (instance method)">#<strong>positional?</strong> &#x21d2; Boolean </a>
292
+
293
+
294
+
295
+ </span>
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+ <span class="summary_desc"><div class='inline'></div></span>
306
+
307
+ </li>
308
+
309
+
310
+ <li class="public ">
311
+ <span class="summary_signature">
312
+
313
+ <a href="#required%3F-instance_method" title="#required? (instance method)">#<strong>required?</strong> &#x21d2; Boolean </a>
314
+
315
+
316
+
317
+ </span>
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+ <span class="summary_desc"><div class='inline'></div></span>
328
+
329
+ </li>
330
+
331
+
332
+ <li class="public ">
333
+ <span class="summary_signature">
334
+
335
+ <a href="#variadic%3F-instance_method" title="#variadic? (instance method)">#<strong>variadic?</strong> &#x21d2; Boolean </a>
336
+
337
+
338
+
339
+ </span>
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <span class="summary_desc"><div class='inline'></div></span>
350
+
351
+ </li>
352
+
353
+
354
+ </ul>
355
+
356
+
357
+ <div id="constructor_details" class="method_details_list">
358
+ <h2>Constructor Details</h2>
359
+
360
+ <div class="method_details first">
361
+ <h3 class="signature first" id="initialize-instance_method">
362
+
363
+ #<strong>initialize</strong>(kind, name, *default_value) &#x21d2; <tt><span class='object_link'><a href="" title="Simple::Service::Action::Parameter (class)">Parameter</a></span></tt>
364
+
365
+
366
+
367
+
368
+
369
+ </h3><div class="docstring">
370
+ <div class="discussion">
371
+
372
+ <p>Returns a new instance of Parameter</p>
373
+
374
+
375
+ </div>
376
+ </div>
377
+ <div class="tags">
378
+
379
+
380
+ </div><table class="source_code">
381
+ <tr>
382
+ <td>
383
+ <pre class="lines">
384
+
385
+
386
+ 31
387
+ 32
388
+ 33
389
+ 34
390
+ 35
391
+ 36
392
+ 37
393
+ 38
394
+ 39
395
+ 40
396
+ 41</pre>
397
+ </td>
398
+ <td>
399
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 31</span>
400
+
401
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_kind'>kind</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_default_value'>default_value</span><span class='rparen'>)</span>
402
+ <span class='comment'># The parameter list matches the values returned from MethodReflection.parameters,
403
+ </span> <span class='comment'># which has two or three entries: &lt;tt&gt;kind, name [ . default_value ]&lt;/tt&gt;
404
+ </span>
405
+ <span class='id identifier rubyid_expect!'>expect!</span> <span class='id identifier rubyid_kind'>kind</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='symbol'>:req</span><span class='comma'>,</span> <span class='symbol'>:opt</span><span class='comma'>,</span> <span class='symbol'>:keyreq</span><span class='comma'>,</span> <span class='symbol'>:key</span><span class='comma'>,</span> <span class='symbol'>:rest</span><span class='rbracket'>]</span>
406
+ <span class='id identifier rubyid_expect!'>expect!</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>1</span><span class='rbracket'>]</span>
407
+
408
+ <span class='ivar'>@kind</span> <span class='op'>=</span> <span class='id identifier rubyid_kind'>kind</span>
409
+ <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
410
+ <span class='ivar'>@default_value</span> <span class='op'>=</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
411
+ <span class='kw'>end</span></pre>
412
+ </td>
413
+ </tr>
414
+ </table>
415
+ </div>
416
+
417
+ </div>
418
+
419
+ <div id="instance_attr_details" class="attr_details">
420
+ <h2>Instance Attribute Details</h2>
421
+
422
+
423
+ <span id=""></span>
424
+ <div class="method_details first">
425
+ <h3 class="signature first" id="default_value-instance_method">
426
+
427
+ #<strong>default_value</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
428
+
429
+
430
+
431
+
432
+
433
+ </h3><div class="docstring">
434
+ <div class="discussion">
435
+
436
+ <p>The parameter&#39;s default value (if any)</p>
437
+
438
+
439
+ </div>
440
+ </div>
441
+ <div class="tags">
442
+
443
+
444
+ </div><table class="source_code">
445
+ <tr>
446
+ <td>
447
+ <pre class="lines">
448
+
449
+
450
+ 29
451
+ 30
452
+ 31</pre>
453
+ </td>
454
+ <td>
455
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 29</span>
456
+
457
+ <span class='kw'>def</span> <span class='id identifier rubyid_default_value'>default_value</span>
458
+ <span class='ivar'>@default_value</span>
459
+ <span class='kw'>end</span></pre>
460
+ </td>
461
+ </tr>
462
+ </table>
463
+ </div>
464
+
465
+
466
+ <span id=""></span>
467
+ <div class="method_details ">
468
+ <h3 class="signature " id="kind-instance_method">
469
+
470
+ #<strong>kind</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
471
+
472
+
473
+
474
+
475
+
476
+ </h3><div class="docstring">
477
+ <div class="discussion">
478
+
479
+ <p>Returns the value of attribute kind</p>
480
+
481
+
482
+ </div>
483
+ </div>
484
+ <div class="tags">
485
+
486
+
487
+ </div><table class="source_code">
488
+ <tr>
489
+ <td>
490
+ <pre class="lines">
491
+
492
+
493
+ 26
494
+ 27
495
+ 28</pre>
496
+ </td>
497
+ <td>
498
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 26</span>
499
+
500
+ <span class='kw'>def</span> <span class='id identifier rubyid_kind'>kind</span>
501
+ <span class='ivar'>@kind</span>
502
+ <span class='kw'>end</span></pre>
503
+ </td>
504
+ </tr>
505
+ </table>
506
+ </div>
507
+
508
+
509
+ <span id=""></span>
510
+ <div class="method_details ">
511
+ <h3 class="signature " id="name-instance_method">
512
+
513
+ #<strong>name</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
514
+
515
+
516
+
517
+
518
+
519
+ </h3><div class="docstring">
520
+ <div class="discussion">
521
+
522
+ <p>Returns the value of attribute name</p>
523
+
524
+
525
+ </div>
526
+ </div>
527
+ <div class="tags">
528
+
529
+
530
+ </div><table class="source_code">
531
+ <tr>
532
+ <td>
533
+ <pre class="lines">
534
+
535
+
536
+ 25
537
+ 26
538
+ 27</pre>
539
+ </td>
540
+ <td>
541
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 25</span>
542
+
543
+ <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
544
+ <span class='ivar'>@name</span>
545
+ <span class='kw'>end</span></pre>
546
+ </td>
547
+ </tr>
548
+ </table>
549
+ </div>
550
+
551
+ </div>
552
+
553
+
554
+ <div id="class_method_details" class="method_details_list">
555
+ <h2>Class Method Details</h2>
556
+
557
+
558
+ <div class="method_details first">
559
+ <h3 class="signature first" id="reflect_on_method-class_method">
560
+
561
+ .<strong>reflect_on_method</strong>(service:, name:) &#x21d2; <tt>Object</tt>
562
+
563
+
564
+
565
+
566
+
567
+ </h3><table class="source_code">
568
+ <tr>
569
+ <td>
570
+ <pre class="lines">
571
+
572
+
573
+ 4
574
+ 5
575
+ 6
576
+ 7</pre>
577
+ </td>
578
+ <td>
579
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 4</span>
580
+
581
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reflect_on_method'>reflect_on_method</span><span class='lparen'>(</span><span class='label'>service:</span><span class='comma'>,</span> <span class='label'>name:</span><span class='rparen'>)</span>
582
+ <span class='id identifier rubyid_reflected_parameters'>reflected_parameters</span> <span class='op'>=</span> <span class='op'>::</span><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="../../Service.html" title="Simple::Service (module)">Service</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Action.html" title="Simple::Service::Action (class)">Action</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="MethodReflection.html" title="Simple::Service::Action::MethodReflection (module)">MethodReflection</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parameters'><span class='object_link'><a href="MethodReflection.html#parameters-instance_method" title="Simple::Service::Action::MethodReflection#parameters (method)">parameters</a></span></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>
583
+ <span class='ivar'>@parameters</span> <span class='op'>=</span> <span class='id identifier rubyid_reflected_parameters'>reflected_parameters</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_ary'>ary</span><span class='op'>|</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_ary'>ary</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
584
+ <span class='kw'>end</span></pre>
585
+ </td>
586
+ </tr>
587
+ </table>
588
+ </div>
589
+
590
+ </div>
591
+
592
+ <div id="instance_method_details" class="method_details_list">
593
+ <h2>Instance Method Details</h2>
594
+
595
+
596
+ <div class="method_details first">
597
+ <h3 class="signature first" id="keyword?-instance_method">
598
+
599
+ #<strong>keyword?</strong> &#x21d2; <tt>Boolean</tt>
600
+
601
+
602
+
603
+
604
+
605
+ </h3><div class="docstring">
606
+ <div class="discussion">
607
+
608
+
609
+ </div>
610
+ </div>
611
+ <div class="tags">
612
+
613
+ <p class="tag_title">Returns:</p>
614
+ <ul class="return">
615
+
616
+ <li>
617
+
618
+
619
+ <span class='type'>(<tt>Boolean</tt>)</span>
620
+
621
+
622
+
623
+ </li>
624
+
625
+ </ul>
626
+
627
+ </div><table class="source_code">
628
+ <tr>
629
+ <td>
630
+ <pre class="lines">
631
+
632
+
633
+ 9
634
+ 10
635
+ 11</pre>
636
+ </td>
637
+ <td>
638
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 9</span>
639
+
640
+ <span class='kw'>def</span> <span class='id identifier rubyid_keyword?'>keyword?</span>
641
+ <span class='lbracket'>[</span><span class='symbol'>:keyreq</span><span class='comma'>,</span> <span class='symbol'>:key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='ivar'>@kind</span>
642
+ <span class='kw'>end</span></pre>
643
+ </td>
644
+ </tr>
645
+ </table>
646
+ </div>
647
+
648
+ <div class="method_details ">
649
+ <h3 class="signature " id="positional?-instance_method">
650
+
651
+ #<strong>positional?</strong> &#x21d2; <tt>Boolean</tt>
652
+
653
+
654
+
655
+
656
+
657
+ </h3><div class="docstring">
658
+ <div class="discussion">
659
+
660
+
661
+ </div>
662
+ </div>
663
+ <div class="tags">
664
+
665
+ <p class="tag_title">Returns:</p>
666
+ <ul class="return">
667
+
668
+ <li>
669
+
670
+
671
+ <span class='type'>(<tt>Boolean</tt>)</span>
672
+
673
+
674
+
675
+ </li>
676
+
677
+ </ul>
678
+
679
+ </div><table class="source_code">
680
+ <tr>
681
+ <td>
682
+ <pre class="lines">
683
+
684
+
685
+ 13
686
+ 14
687
+ 15</pre>
688
+ </td>
689
+ <td>
690
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 13</span>
691
+
692
+ <span class='kw'>def</span> <span class='id identifier rubyid_positional?'>positional?</span>
693
+ <span class='lbracket'>[</span><span class='symbol'>:req</span><span class='comma'>,</span> <span class='symbol'>:opt</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='ivar'>@kind</span>
694
+ <span class='kw'>end</span></pre>
695
+ </td>
696
+ </tr>
697
+ </table>
698
+ </div>
699
+
700
+ <div class="method_details ">
701
+ <h3 class="signature " id="required?-instance_method">
702
+
703
+ #<strong>required?</strong> &#x21d2; <tt>Boolean</tt>
704
+
705
+
706
+
707
+
708
+
709
+ </h3><div class="docstring">
710
+ <div class="discussion">
711
+
712
+
713
+ </div>
714
+ </div>
715
+ <div class="tags">
716
+
717
+ <p class="tag_title">Returns:</p>
718
+ <ul class="return">
719
+
720
+ <li>
721
+
722
+
723
+ <span class='type'>(<tt>Boolean</tt>)</span>
724
+
725
+
726
+
727
+ </li>
728
+
729
+ </ul>
730
+
731
+ </div><table class="source_code">
732
+ <tr>
733
+ <td>
734
+ <pre class="lines">
735
+
736
+
737
+ 17
738
+ 18
739
+ 19</pre>
740
+ </td>
741
+ <td>
742
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 17</span>
743
+
744
+ <span class='kw'>def</span> <span class='id identifier rubyid_required?'>required?</span>
745
+ <span class='lbracket'>[</span><span class='symbol'>:req</span><span class='comma'>,</span> <span class='symbol'>:keyreq</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='ivar'>@kind</span>
746
+ <span class='kw'>end</span></pre>
747
+ </td>
748
+ </tr>
749
+ </table>
750
+ </div>
751
+
752
+ <div class="method_details ">
753
+ <h3 class="signature " id="variadic?-instance_method">
754
+
755
+ #<strong>variadic?</strong> &#x21d2; <tt>Boolean</tt>
756
+
757
+
758
+
759
+
760
+
761
+ </h3><div class="docstring">
762
+ <div class="discussion">
763
+
764
+
765
+ </div>
766
+ </div>
767
+ <div class="tags">
768
+
769
+ <p class="tag_title">Returns:</p>
770
+ <ul class="return">
771
+
772
+ <li>
773
+
774
+
775
+ <span class='type'>(<tt>Boolean</tt>)</span>
776
+
777
+
778
+
779
+ </li>
780
+
781
+ </ul>
782
+
783
+ </div><table class="source_code">
784
+ <tr>
785
+ <td>
786
+ <pre class="lines">
787
+
788
+
789
+ 21
790
+ 22
791
+ 23</pre>
792
+ </td>
793
+ <td>
794
+ <pre class="code"><span class="info file"># File 'lib/simple/service/action/parameter.rb', line 21</span>
795
+
796
+ <span class='kw'>def</span> <span class='id identifier rubyid_variadic?'>variadic?</span>
797
+ <span class='ivar'>@kind</span> <span class='op'>==</span> <span class='symbol'>:rest</span>
798
+ <span class='kw'>end</span></pre>
799
+ </td>
800
+ </tr>
801
+ </table>
802
+ </div>
803
+
804
+ </div>
805
+
806
+ </div>
807
+
808
+ <div id="footer">
809
+ Generated on Tue Dec 3 13:46:26 2019 by
810
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
811
+ 0.9.20 (ruby-2.5.1).
812
+ </div>
813
+
814
+ </div>
815
+ </body>
816
+ </html>