ballast 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +21 -0
- data/README.md +40 -0
- data/Rakefile +28 -0
- data/ballast.gemspec +35 -0
- data/doc/Ballast/Concerns/Ajax.html +806 -0
- data/doc/Ballast/Concerns/Common.html +900 -0
- data/doc/Ballast/Concerns/ErrorsHandling.html +283 -0
- data/doc/Ballast/Concerns/View.html +664 -0
- data/doc/Ballast/Concerns.html +127 -0
- data/doc/Ballast/Context.html +417 -0
- data/doc/Ballast/Errors/BaseError.html +326 -0
- data/doc/Ballast/Errors/InvalidDomain.html +157 -0
- data/doc/Ballast/Errors/PerformError.html +157 -0
- data/doc/Ballast/Errors/ValidationError.html +157 -0
- data/doc/Ballast/Errors.html +125 -0
- data/doc/Ballast/Operation.html +1304 -0
- data/doc/Ballast/OperationsChain.html +585 -0
- data/doc/Ballast/Version.html +189 -0
- data/doc/Ballast.html +130 -0
- data/doc/_index.html +267 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +115 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +115 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +269 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/ballast/concerns/ajax.rb +116 -0
- data/lib/ballast/concerns/common.rb +97 -0
- data/lib/ballast/concerns/errors_handling.rb +49 -0
- data/lib/ballast/concerns/view.rb +63 -0
- data/lib/ballast/context.rb +38 -0
- data/lib/ballast/errors.rb +34 -0
- data/lib/ballast/operation.rb +136 -0
- data/lib/ballast/operations_chain.rb +38 -0
- data/lib/ballast/version.rb +24 -0
- data/lib/ballast.rb +24 -0
- data/spec/ballast/concerns/ajax_spec.rb +124 -0
- data/spec/ballast/concerns/common_spec.rb +100 -0
- data/spec/ballast/concerns/errors_handling_spec.rb +63 -0
- data/spec/ballast/concerns/view_spec.rb +107 -0
- data/spec/ballast/context_spec.rb +23 -0
- data/spec/ballast/errors_spec.rb +16 -0
- data/spec/ballast/operation_spec.rb +175 -0
- data/spec/ballast/operations_chain_spec.rb +33 -0
- data/spec/coverage_helper.rb +19 -0
- data/spec/spec_helper.rb +19 -0
- metadata +225 -0
@@ -0,0 +1,585 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Ballast::OperationsChain
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.3
|
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
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (O)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Ballast.html" title="Ballast (module)">Ballast</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">OperationsChain</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Ballast::OperationsChain
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="Operation.html" title="Ballast::Operation (class)">Operation</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="Operation.html" title="Ballast::Operation (class)">Operation</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Ballast::OperationsChain</li>
|
84
|
+
|
85
|
+
</ul>
|
86
|
+
<a href="#" class="inheritanceTree">show all</a>
|
87
|
+
|
88
|
+
</dd>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dt class="r2">Includes:</dt>
|
96
|
+
<dd class="r2">Interactor::Organizer</dd>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dt class="r1 last">Defined in:</dt>
|
103
|
+
<dd class="r1 last">lib/ballast/operations_chain.rb</dd>
|
104
|
+
|
105
|
+
</dl>
|
106
|
+
<div class="clear"></div>
|
107
|
+
|
108
|
+
<h2>Overview</h2><div class="docstring">
|
109
|
+
<div class="discussion">
|
110
|
+
<p>A operation made of several operation run sequentially passing the common context. The chain will stop on the first failure.</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
123
|
+
<ul class="summary">
|
124
|
+
|
125
|
+
<li class="public ">
|
126
|
+
<span class="summary_signature">
|
127
|
+
|
128
|
+
<a href="#operations-instance_method" title="#operations (instance method)">- (Array) <strong>operations</strong> </a>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<span class="note title readonly">readonly</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'><p>The list of operations performed.</p>
|
148
|
+
</div></span>
|
149
|
+
|
150
|
+
</li>
|
151
|
+
|
152
|
+
|
153
|
+
</ul>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<h2>
|
160
|
+
Class Method Summary
|
161
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
162
|
+
</h2>
|
163
|
+
|
164
|
+
<ul class="summary">
|
165
|
+
|
166
|
+
<li class="public ">
|
167
|
+
<span class="summary_signature">
|
168
|
+
|
169
|
+
<a href="#perform-class_method" title="perform (class method)">+ (Operation) <strong>perform</strong>(argument, operations, context: nil, params: {}) </a>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
</span>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<span class="summary_desc"><div class='inline'><p>Performs the chain.</p>
|
184
|
+
</div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
</ul>
|
190
|
+
|
191
|
+
<h2>
|
192
|
+
Instance Method Summary
|
193
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
194
|
+
</h2>
|
195
|
+
|
196
|
+
<ul class="summary">
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (OperationsChain) <strong>initialize</strong>(operations, context) </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
<span class="note title constructor">constructor</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new chain.</p>
|
218
|
+
</div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
</ul>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Operation.html" title="Ballast::Operation (class)">Operation</a></span></h3>
|
237
|
+
<p class="inherited"><span class='object_link'><a href="Operation.html#fail%21-instance_method" title="Ballast::Operation#fail! (method)">#fail!</a></span>, <span class='object_link'><a href="Operation.html#import_error-instance_method" title="Ballast::Operation#import_error (method)">#import_error</a></span>, <span class='object_link'><a href="Operation.html#import_response-instance_method" title="Ballast::Operation#import_response (method)">#import_response</a></span>, <span class='object_link'><a href="Operation.html#in_em_thread-instance_method" title="Ballast::Operation#in_em_thread (method)">#in_em_thread</a></span>, <span class='object_link'><a href="Operation.html#method_missing-instance_method" title="Ballast::Operation#method_missing (method)">#method_missing</a></span>, <span class='object_link'><a href="Operation.html#perform_with_handling-instance_method" title="Ballast::Operation#perform_with_handling (method)">#perform_with_handling</a></span>, <span class='object_link'><a href="Operation.html#resolve_error-instance_method" title="Ballast::Operation#resolve_error (method)">#resolve_error</a></span>, <span class='object_link'><a href="Operation.html#setup_response-instance_method" title="Ballast::Operation#setup_response (method)">#setup_response</a></span></p>
|
238
|
+
|
239
|
+
|
240
|
+
<div id="constructor_details" class="method_details_list">
|
241
|
+
<h2>Constructor Details</h2>
|
242
|
+
|
243
|
+
<div class="method_details first">
|
244
|
+
<h3 class="signature first" id="initialize-instance_method">
|
245
|
+
|
246
|
+
- (<tt><span class='object_link'><a href="" title="Ballast::OperationsChain (class)">OperationsChain</a></span></tt>) <strong>initialize</strong>(operations, context)
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</h3><div class="docstring">
|
253
|
+
<div class="discussion">
|
254
|
+
<p>Creates a new chain.</p>
|
255
|
+
|
256
|
+
|
257
|
+
</div>
|
258
|
+
</div>
|
259
|
+
<div class="tags">
|
260
|
+
<p class="tag_title">Parameters:</p>
|
261
|
+
<ul class="param">
|
262
|
+
|
263
|
+
<li>
|
264
|
+
|
265
|
+
<span class='name'>operations</span>
|
266
|
+
|
267
|
+
|
268
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
—
|
273
|
+
<div class='inline'><p>The list of operations to perform.</p>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
</li>
|
277
|
+
|
278
|
+
<li>
|
279
|
+
|
280
|
+
<span class='name'>context</span>
|
281
|
+
|
282
|
+
|
283
|
+
<span class='type'>(<tt><span class='object_link'><a href="Context.html" title="Ballast::Context (class)">Context</a></span></tt>)</span>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
—
|
288
|
+
<div class='inline'><p>The context for the chain.</p>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</li>
|
292
|
+
|
293
|
+
</ul>
|
294
|
+
|
295
|
+
|
296
|
+
</div><table class="source_code">
|
297
|
+
<tr>
|
298
|
+
<td>
|
299
|
+
<pre class="lines">
|
300
|
+
|
301
|
+
|
302
|
+
32
|
303
|
+
33
|
304
|
+
34
|
305
|
+
35
|
306
|
+
36</pre>
|
307
|
+
</td>
|
308
|
+
<td>
|
309
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/operations_chain.rb', line 32</span>
|
310
|
+
|
311
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
312
|
+
<span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_context'>context</span>
|
313
|
+
<span class='ivar'>@operations</span> <span class='op'>=</span> <span class='id identifier rubyid_operations'>operations</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span>
|
314
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
315
|
+
<span class='kw'>end</span></pre>
|
316
|
+
</td>
|
317
|
+
</tr>
|
318
|
+
</table>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
<div id="method_missing_details" class="method_details_list">
|
323
|
+
<h2>Dynamic Method Handling</h2>
|
324
|
+
<p class="notice super">
|
325
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
326
|
+
|
327
|
+
in the class <span class='object_link'><a href="Operation.html#method_missing-instance_method" title="Ballast::Operation#method_missing (method)">Ballast::Operation</a></span>
|
328
|
+
|
329
|
+
</p>
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<div id="instance_attr_details" class="attr_details">
|
334
|
+
<h2>Instance Attribute Details</h2>
|
335
|
+
|
336
|
+
|
337
|
+
<span id=""></span>
|
338
|
+
<div class="method_details first">
|
339
|
+
<h3 class="signature first" id="operations-instance_method">
|
340
|
+
|
341
|
+
- (<tt>Array</tt>) <strong>operations</strong> <span class="extras">(readonly)</span>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
</h3><div class="docstring">
|
348
|
+
<div class="discussion">
|
349
|
+
<p>Returns The list of operations performed.</p>
|
350
|
+
|
351
|
+
|
352
|
+
</div>
|
353
|
+
</div>
|
354
|
+
<div class="tags">
|
355
|
+
|
356
|
+
<p class="tag_title">Returns:</p>
|
357
|
+
<ul class="return">
|
358
|
+
|
359
|
+
<li>
|
360
|
+
|
361
|
+
|
362
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
—
|
367
|
+
<div class='inline'><p>The list of operations performed.</p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</li>
|
371
|
+
|
372
|
+
</ul>
|
373
|
+
|
374
|
+
</div><table class="source_code">
|
375
|
+
<tr>
|
376
|
+
<td>
|
377
|
+
<pre class="lines">
|
378
|
+
|
379
|
+
|
380
|
+
11
|
381
|
+
12
|
382
|
+
13
|
383
|
+
14
|
384
|
+
15
|
385
|
+
16
|
386
|
+
17
|
387
|
+
18
|
388
|
+
19
|
389
|
+
20
|
390
|
+
21
|
391
|
+
22
|
392
|
+
23
|
393
|
+
24
|
394
|
+
25
|
395
|
+
26
|
396
|
+
27
|
397
|
+
28
|
398
|
+
29
|
399
|
+
30
|
400
|
+
31
|
401
|
+
32
|
402
|
+
33
|
403
|
+
34
|
404
|
+
35
|
405
|
+
36
|
406
|
+
37</pre>
|
407
|
+
</td>
|
408
|
+
<td>
|
409
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/operations_chain.rb', line 11</span>
|
410
|
+
|
411
|
+
<span class='kw'>class</span> <span class='const'>OperationsChain</span> <span class='op'><</span> <span class='const'>Operation</span>
|
412
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Interactor</span><span class='op'>::</span><span class='const'>Organizer</span>
|
413
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:operations</span>
|
414
|
+
|
415
|
+
<span class='comment'># Performs the chain.
|
416
|
+
</span> <span class='comment'>#
|
417
|
+
</span> <span class='comment'># @param argument [Object|Context] If is a context, then it will be the context of the operation, unless a blank a context with the object
|
418
|
+
</span> <span class='comment'># as owner will be created.
|
419
|
+
</span> <span class='comment'># @param operations [Array] The list of operations to perform.
|
420
|
+
</span> <span class='comment'># @param context [NilClass] The context for the operation. *Ignored if `owner_or_context` is a context.*
|
421
|
+
</span> <span class='comment'># @param params [Hash] The additional parameters for the new context. *Ignored if `owner_or_context` is a context.*
|
422
|
+
</span> <span class='comment'># @return [Operation] The performed chain.
|
423
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='label'>context:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
424
|
+
<span class='id identifier rubyid_argument'>argument</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span> <span class='op'>||</span> <span class='op'>::</span><span class='const'>Ballast</span><span class='op'>::</span><span class='const'>Context</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_argument'>argument</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Ballast</span><span class='op'>::</span><span class='const'>Context</span><span class='rparen'>)</span>
|
425
|
+
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='id identifier rubyid_argument'>argument</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:perform</span><span class='rparen'>)</span>
|
426
|
+
<span class='kw'>end</span>
|
427
|
+
|
428
|
+
<span class='comment'># Creates a new chain.
|
429
|
+
</span> <span class='comment'>#
|
430
|
+
</span> <span class='comment'># @param operations [Array] The list of operations to perform.
|
431
|
+
</span> <span class='comment'># @param context [Context] The context for the chain.
|
432
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
433
|
+
<span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_context'>context</span>
|
434
|
+
<span class='ivar'>@operations</span> <span class='op'>=</span> <span class='id identifier rubyid_operations'>operations</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span>
|
435
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
436
|
+
<span class='kw'>end</span>
|
437
|
+
<span class='kw'>end</span></pre>
|
438
|
+
</td>
|
439
|
+
</tr>
|
440
|
+
</table>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
</div>
|
444
|
+
|
445
|
+
|
446
|
+
<div id="class_method_details" class="method_details_list">
|
447
|
+
<h2>Class Method Details</h2>
|
448
|
+
|
449
|
+
|
450
|
+
<div class="method_details first">
|
451
|
+
<h3 class="signature first" id="perform-class_method">
|
452
|
+
|
453
|
+
+ (<tt><span class='object_link'><a href="Operation.html" title="Ballast::Operation (class)">Operation</a></span></tt>) <strong>perform</strong>(argument, operations, context: nil, params: {})
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
</h3><div class="docstring">
|
460
|
+
<div class="discussion">
|
461
|
+
<p>Performs the chain.</p>
|
462
|
+
|
463
|
+
|
464
|
+
</div>
|
465
|
+
</div>
|
466
|
+
<div class="tags">
|
467
|
+
<p class="tag_title">Parameters:</p>
|
468
|
+
<ul class="param">
|
469
|
+
|
470
|
+
<li>
|
471
|
+
|
472
|
+
<span class='name'>argument</span>
|
473
|
+
|
474
|
+
|
475
|
+
<span class='type'>(<tt>Object|<span class='object_link'><a href="Context.html" title="Ballast::Context (class)">Context</a></span></tt>)</span>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
—
|
480
|
+
<div class='inline'><p>If is a context, then it will be the context of the operation, unless a blank a context with the object
|
481
|
+
as owner will be created.</p>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
</li>
|
485
|
+
|
486
|
+
<li>
|
487
|
+
|
488
|
+
<span class='name'>operations</span>
|
489
|
+
|
490
|
+
|
491
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
—
|
496
|
+
<div class='inline'><p>The list of operations to perform.</p>
|
497
|
+
</div>
|
498
|
+
|
499
|
+
</li>
|
500
|
+
|
501
|
+
<li>
|
502
|
+
|
503
|
+
<span class='name'>context</span>
|
504
|
+
|
505
|
+
|
506
|
+
<span class='type'>(<tt>NilClass</tt>)</span>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
—
|
511
|
+
<div class='inline'><p>The context for the operation. <em>Ignored if <code>owner_or_context</code> is a context.</em></p>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</li>
|
515
|
+
|
516
|
+
<li>
|
517
|
+
|
518
|
+
<span class='name'>params</span>
|
519
|
+
|
520
|
+
|
521
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
—
|
526
|
+
<div class='inline'><p>The additional parameters for the new context. <em>Ignored if <code>owner_or_context</code> is a context.</em></p>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
</li>
|
530
|
+
|
531
|
+
</ul>
|
532
|
+
|
533
|
+
<p class="tag_title">Returns:</p>
|
534
|
+
<ul class="return">
|
535
|
+
|
536
|
+
<li>
|
537
|
+
|
538
|
+
|
539
|
+
<span class='type'>(<tt><span class='object_link'><a href="Operation.html" title="Ballast::Operation (class)">Operation</a></span></tt>)</span>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
—
|
544
|
+
<div class='inline'><p>The performed chain.</p>
|
545
|
+
</div>
|
546
|
+
|
547
|
+
</li>
|
548
|
+
|
549
|
+
</ul>
|
550
|
+
|
551
|
+
</div><table class="source_code">
|
552
|
+
<tr>
|
553
|
+
<td>
|
554
|
+
<pre class="lines">
|
555
|
+
|
556
|
+
|
557
|
+
23
|
558
|
+
24
|
559
|
+
25
|
560
|
+
26</pre>
|
561
|
+
</td>
|
562
|
+
<td>
|
563
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/operations_chain.rb', line 23</span>
|
564
|
+
|
565
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='label'>context:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
566
|
+
<span class='id identifier rubyid_argument'>argument</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span> <span class='op'>||</span> <span class='op'>::</span><span class='const'>Ballast</span><span class='op'>::</span><span class='const'>Context</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='id identifier rubyid_argument'>argument</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_argument'>argument</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Ballast</span><span class='op'>::</span><span class='const'>Context</span><span class='rparen'>)</span>
|
567
|
+
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_operations'>operations</span><span class='comma'>,</span> <span class='id identifier rubyid_argument'>argument</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:perform</span><span class='rparen'>)</span>
|
568
|
+
<span class='kw'>end</span></pre>
|
569
|
+
</td>
|
570
|
+
</tr>
|
571
|
+
</table>
|
572
|
+
</div>
|
573
|
+
|
574
|
+
</div>
|
575
|
+
|
576
|
+
</div>
|
577
|
+
|
578
|
+
<div id="footer">
|
579
|
+
Generated on Wed Dec 25 11:35:23 2013 by
|
580
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
581
|
+
0.8.7.3 (ruby-2.0.0).
|
582
|
+
</div>
|
583
|
+
|
584
|
+
</body>
|
585
|
+
</html>
|