ballast 2.0.1 → 2.1.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 +4 -4
- data/.gitignore +1 -2
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/ballast.gemspec +1 -1
- data/doc/Ballast/AjaxResponse.html +312 -264
- data/doc/Ballast/Concerns/AjaxHandling.html +39 -34
- data/doc/Ballast/Concerns/Common.html +231 -93
- data/doc/Ballast/Concerns/ErrorsHandling.html +15 -14
- data/doc/Ballast/Concerns/View.html +43 -36
- data/doc/Ballast/Concerns.html +2 -2
- data/doc/Ballast/Configuration.html +23 -20
- data/doc/Ballast/Emoji/Character.html +19 -16
- data/doc/Ballast/Emoji/Utils.html +87 -82
- data/doc/Ballast/Emoji.html +2 -2
- data/doc/Ballast/Errors/Base.html +19 -17
- data/doc/Ballast/Errors/Failure.html +2 -2
- data/doc/Ballast/Errors/InvalidDomain.html +2 -2
- data/doc/Ballast/Errors/ValidationFailure.html +2 -2
- data/doc/Ballast/Errors.html +3 -3
- data/doc/Ballast/Middlewares/DefaultHost.html +19 -17
- data/doc/Ballast/Middlewares.html +2 -2
- data/doc/Ballast/RequestDomainMatcher.html +118 -112
- data/doc/Ballast/Service/Response.html +216 -208
- data/doc/Ballast/Service.html +172 -178
- data/doc/Ballast/Version.html +10 -6
- data/doc/Ballast.html +15 -14
- data/doc/_index.html +2 -2
- data/doc/file.README.html +4 -4
- data/doc/index.html +4 -4
- data/doc/method_list.html +24 -18
- data/doc/top-level-namespace.html +2 -39
- data/lib/ballast/ajax_response.rb +6 -1
- data/lib/ballast/concerns/common.rb +10 -0
- data/lib/ballast/errors.rb +1 -1
- data/lib/ballast/version.rb +3 -3
- data/spec/ballast/concerns/common_spec.rb +26 -0
- metadata +5 -19
- data/tmp/saikuro/index_cyclo.html +0 -158
- data/tmp/saikuro/lib/ballast/concerns/ajax.rb_cyclo.html +0 -21
- data/tmp/saikuro/lib/ballast/concerns/common.rb_cyclo.html +0 -20
- data/tmp/saikuro/lib/ballast/concerns/errors_handling.rb_cyclo.html +0 -14
- data/tmp/saikuro/lib/ballast/concerns/view.rb_cyclo.html +0 -20
- data/tmp/saikuro/lib/ballast/configuration.rb_cyclo.html +0 -10
- data/tmp/saikuro/lib/ballast/context.rb_cyclo.html +0 -11
- data/tmp/saikuro/lib/ballast/errors.rb_cyclo.html +0 -22
- data/tmp/saikuro/lib/ballast/middlewares/default_host.rb_cyclo.html +0 -14
- data/tmp/saikuro/lib/ballast/operation.rb_cyclo.html +0 -19
- data/tmp/saikuro/lib/ballast/operations_chain.rb_cyclo.html +0 -12
- data/tmp/saikuro/lib/ballast/request_domain_matcher.rb_cyclo.html +0 -11
- data/tmp/saikuro/lib/ballast/version.rb_cyclo.html +0 -9
- data/tmp/saikuro/lib/ballast.rb_cyclo.html +0 -8
data/doc/Ballast/Version.html
CHANGED
@@ -119,7 +119,8 @@
|
|
119
119
|
|
120
120
|
</div>
|
121
121
|
</dt>
|
122
|
-
<dd><pre class="code"><span class='
|
122
|
+
<dd><pre class="code"><span class='integer val'>2</span>
|
123
|
+
</pre></dd>
|
123
124
|
|
124
125
|
<dt id="MINOR-constant" class="">MINOR =
|
125
126
|
<div class="docstring">
|
@@ -134,7 +135,8 @@
|
|
134
135
|
|
135
136
|
</div>
|
136
137
|
</dt>
|
137
|
-
<dd><pre class="code"><span class='
|
138
|
+
<dd><pre class="code"><span class='integer val'>1</span>
|
139
|
+
</pre></dd>
|
138
140
|
|
139
141
|
<dt id="PATCH-constant" class="">PATCH =
|
140
142
|
<div class="docstring">
|
@@ -149,7 +151,8 @@
|
|
149
151
|
|
150
152
|
</div>
|
151
153
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='
|
154
|
+
<dd><pre class="code"><span class='integer val'>0</span>
|
155
|
+
</pre></dd>
|
153
156
|
|
154
157
|
<dt id="STRING-constant" class="">STRING =
|
155
158
|
<div class="docstring">
|
@@ -164,7 +167,8 @@
|
|
164
167
|
|
165
168
|
</div>
|
166
169
|
</dt>
|
167
|
-
<dd><pre class="code"><span class='
|
170
|
+
<dd><pre class="code"><span class='lbrack token'>[</span><span class='rubyid_MAJOR constant id'>MAJOR</span><span class='comma token'>,</span> <span class='rubyid_MINOR constant id'>MINOR</span><span class='comma token'>,</span> <span class='rubyid_PATCH constant id'>PATCH</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_compact identifier id'>compact</span><span class='dot token'>.</span><span class='rubyid_join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>"."</span><span class='rparen token'>)</span>
|
171
|
+
</pre></dd>
|
168
172
|
|
169
173
|
</dl>
|
170
174
|
|
@@ -180,9 +184,9 @@
|
|
180
184
|
</div>
|
181
185
|
|
182
186
|
<div id="footer">
|
183
|
-
Generated on
|
187
|
+
Generated on Sun Jan 18 13:27:09 2015 by
|
184
188
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
|
-
0.8.7.6 (ruby-2.
|
189
|
+
0.8.7.6 (ruby-2.2.0).
|
186
190
|
</div>
|
187
191
|
|
188
192
|
</body>
|
data/doc/Ballast.html
CHANGED
@@ -233,18 +233,19 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
233
233
|
<td>
|
234
234
|
<pre class="code"><span class="info file"># File 'lib/ballast.rb', line 38</span>
|
235
235
|
|
236
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='
|
237
|
-
<span class='kw'>if</span> <span class='
|
238
|
-
<span class='
|
239
|
-
<span class='kw'>elsif</span> <span class='
|
240
|
-
<span class='
|
241
|
-
<span class='
|
242
|
-
<span class='
|
243
|
-
<span class='kw'>end</span>
|
244
|
-
<span class='kw'>else</span>
|
245
|
-
<span class='
|
246
|
-
<span class='kw'>end</span>
|
247
|
-
<span class='kw'>end</span
|
236
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_in_em_thread identifier id'>in_em_thread</span><span class='lparen token'>(</span><span class='rubyid_start_reactor identifier id'>start_reactor</span> <span class='assign token'>=</span> <span class='rubyid_false false kw'>false</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
|
237
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_EM constant id'>EM</span><span class='dot token'>.</span><span class='rubyid_reactor_running? fid id'>reactor_running?</span>
|
238
|
+
<span class='rubyid_run_in_thread identifier id'>run_in_thread</span><span class='lparen token'>(</span><span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
|
239
|
+
<span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_start_reactor identifier id'>start_reactor</span>
|
240
|
+
<span class='rubyid_EM constant id'>EM</span><span class='dot token'>.</span><span class='rubyid_synchrony identifier id'>synchrony</span> <span class='rubyid_do do kw'>do</span>
|
241
|
+
<span class='rubyid_Ballast constant id'>Ballast</span><span class='dot token'>.</span><span class='rubyid_in_em_thread identifier id'>in_em_thread</span><span class='lparen token'>(</span><span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
|
242
|
+
<span class='rubyid_EM constant id'>EM</span><span class='dot token'>.</span><span class='rubyid_stop identifier id'>stop</span>
|
243
|
+
<span class='rubyid_end end kw'>end</span>
|
244
|
+
<span class='rubyid_else else kw'>else</span>
|
245
|
+
<span class='rubyid_block identifier id'>block</span><span class='dot token'>.</span><span class='rubyid_call identifier id'>call</span>
|
246
|
+
<span class='rubyid_end end kw'>end</span>
|
247
|
+
<span class='rubyid_end end kw'>end</span>
|
248
|
+
</pre>
|
248
249
|
</td>
|
249
250
|
</tr>
|
250
251
|
</table>
|
@@ -255,9 +256,9 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
255
256
|
</div>
|
256
257
|
|
257
258
|
<div id="footer">
|
258
|
-
Generated on
|
259
|
+
Generated on Sun Jan 18 13:27:09 2015 by
|
259
260
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
260
|
-
0.8.7.6 (ruby-2.
|
261
|
+
0.8.7.6 (ruby-2.2.0).
|
261
262
|
</div>
|
262
263
|
|
263
264
|
</body>
|
data/doc/_index.html
CHANGED
@@ -339,9 +339,9 @@
|
|
339
339
|
</div>
|
340
340
|
|
341
341
|
<div id="footer">
|
342
|
-
Generated on
|
342
|
+
Generated on Sun Jan 18 13:27:08 2015 by
|
343
343
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
344
|
-
0.8.7.6 (ruby-2.
|
344
|
+
0.8.7.6 (ruby-2.2.0).
|
345
345
|
</div>
|
346
346
|
|
347
347
|
</body>
|
data/doc/file.README.html
CHANGED
@@ -70,7 +70,7 @@
|
|
70
70
|
<a href="https://coveralls.io/r/ShogunPanda/ballast"><img src="https://coveralls.io/repos/ShogunPanda/ballast/badge.png" alt="Coverage Status" /></a>
|
71
71
|
<a href="https://bitdeli.com/free" title="Bitdeli Badge"><img src="https://d2weczhvl823v0.cloudfront.net/ShogunPanda/ballast/trend.png" alt="Bitdeli Trend" /></a></p>
|
72
72
|
|
73
|
-
<p>A collection of base utilities for
|
73
|
+
<p>A collection of base utilities for web frameworks.</p>
|
74
74
|
|
75
75
|
<p>http://sw.cowtech.it/ballast</p>
|
76
76
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
|
79
79
|
<h1 id="description">Description</h1>
|
80
80
|
|
81
|
-
<p>Ballast is a gem which tries to solve common issues which we all (or, at least, me) usually encounter when we develop with Ruby On Rails.</p>
|
81
|
+
<p>Ballast is a gem which tries to solve common issues which we all (or, at least, me) usually encounter when we develop with Ruby On Rails or other web frameworks.</p>
|
82
82
|
|
83
83
|
<p>The first big issue is having fat controllers. To solve this, ballast enbraces the idea of the <a href="https://github.com/collectiveidea/interactor">interactor</a> gem and it implements a service interface.</p>
|
84
84
|
|
@@ -106,9 +106,9 @@
|
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Jan 18 13:27:08 2015 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
-
0.8.7.6 (ruby-2.
|
111
|
+
0.8.7.6 (ruby-2.2.0).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</body>
|
data/doc/index.html
CHANGED
@@ -70,7 +70,7 @@
|
|
70
70
|
<a href="https://coveralls.io/r/ShogunPanda/ballast"><img src="https://coveralls.io/repos/ShogunPanda/ballast/badge.png" alt="Coverage Status" /></a>
|
71
71
|
<a href="https://bitdeli.com/free" title="Bitdeli Badge"><img src="https://d2weczhvl823v0.cloudfront.net/ShogunPanda/ballast/trend.png" alt="Bitdeli Trend" /></a></p>
|
72
72
|
|
73
|
-
<p>A collection of base utilities for
|
73
|
+
<p>A collection of base utilities for web frameworks.</p>
|
74
74
|
|
75
75
|
<p>http://sw.cowtech.it/ballast</p>
|
76
76
|
|
@@ -78,7 +78,7 @@
|
|
78
78
|
|
79
79
|
<h1 id="description">Description</h1>
|
80
80
|
|
81
|
-
<p>Ballast is a gem which tries to solve common issues which we all (or, at least, me) usually encounter when we develop with Ruby On Rails.</p>
|
81
|
+
<p>Ballast is a gem which tries to solve common issues which we all (or, at least, me) usually encounter when we develop with Ruby On Rails or other web frameworks.</p>
|
82
82
|
|
83
83
|
<p>The first big issue is having fat controllers. To solve this, ballast enbraces the idea of the <a href="https://github.com/collectiveidea/interactor">interactor</a> gem and it implements a service interface.</p>
|
84
84
|
|
@@ -106,9 +106,9 @@
|
|
106
106
|
</div></div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Jan 18 13:27:08 2015 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
-
0.8.7.6 (ruby-2.
|
111
|
+
0.8.7.6 (ruby-2.2.0).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</body>
|
data/doc/method_list.html
CHANGED
@@ -322,114 +322,120 @@
|
|
322
322
|
|
323
323
|
|
324
324
|
<li class="r2 ">
|
325
|
+
<span class='object_link'><a href="Ballast/Concerns/Common.html#perform_service-instance_method" title="Ballast::Concerns::Common#perform_service (method)">#perform_service</a></span>
|
326
|
+
<small>Ballast::Concerns::Common</small>
|
327
|
+
</li>
|
328
|
+
|
329
|
+
|
330
|
+
<li class="r1 ">
|
325
331
|
<span class='object_link'><a href="Ballast/Concerns/AjaxHandling.html#prepare_ajax_response-instance_method" title="Ballast::Concerns::AjaxHandling#prepare_ajax_response (method)">#prepare_ajax_response</a></span>
|
326
332
|
<small>Ballast::Concerns::AjaxHandling</small>
|
327
333
|
</li>
|
328
334
|
|
329
335
|
|
330
|
-
<li class="
|
336
|
+
<li class="r2 ">
|
331
337
|
<span class='object_link'><a href="Ballast/Concerns/AjaxHandling.html#prevent_caching-instance_method" title="Ballast::Concerns::AjaxHandling#prevent_caching (method)">#prevent_caching</a></span>
|
332
338
|
<small>Ballast::Concerns::AjaxHandling</small>
|
333
339
|
</li>
|
334
340
|
|
335
341
|
|
336
|
-
<li class="
|
342
|
+
<li class="r1 ">
|
337
343
|
<span class='object_link'><a href="Ballast/Emoji/Utils.html#replace-instance_method" title="Ballast::Emoji::Utils#replace (method)">#replace</a></span>
|
338
344
|
<small>Ballast::Emoji::Utils</small>
|
339
345
|
</li>
|
340
346
|
|
341
347
|
|
342
|
-
<li class="
|
348
|
+
<li class="r2 ">
|
343
349
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
|
344
350
|
<small>Ballast::RequestDomainMatcher</small>
|
345
351
|
</li>
|
346
352
|
|
347
353
|
|
348
|
-
<li class="
|
354
|
+
<li class="r1 ">
|
349
355
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
|
350
356
|
<small>Ballast::RequestDomainMatcher</small>
|
351
357
|
</li>
|
352
358
|
|
353
359
|
|
354
|
-
<li class="
|
360
|
+
<li class="r2 ">
|
355
361
|
<span class='object_link'><a href="Ballast/Emoji/Utils.html#replace_regex-instance_method" title="Ballast::Emoji::Utils#replace_regex (method)">#replace_regex</a></span>
|
356
362
|
<small>Ballast::Emoji::Utils</small>
|
357
363
|
</li>
|
358
364
|
|
359
365
|
|
360
|
-
<li class="
|
366
|
+
<li class="r1 ">
|
361
367
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
|
362
368
|
<small>Ballast::RequestDomainMatcher</small>
|
363
369
|
</li>
|
364
370
|
|
365
371
|
|
366
|
-
<li class="
|
372
|
+
<li class="r2 ">
|
367
373
|
<span class='object_link'><a href="Ballast/AjaxResponse.html#reply-instance_method" title="Ballast::AjaxResponse#reply (method)">#reply</a></span>
|
368
374
|
<small>Ballast::AjaxResponse</small>
|
369
375
|
</li>
|
370
376
|
|
371
377
|
|
372
|
-
<li class="
|
378
|
+
<li class="r1 ">
|
373
379
|
<span class='object_link'><a href="Ballast/Concerns/Common.html#request_data%3F-instance_method" title="Ballast::Concerns::Common#request_data? (method)">#request_data?</a></span>
|
374
380
|
<small>Ballast::Concerns::Common</small>
|
375
381
|
</li>
|
376
382
|
|
377
383
|
|
378
|
-
<li class="
|
384
|
+
<li class="r2 ">
|
379
385
|
<span class='object_link'><a href="Ballast/Concerns/View.html#scope_css-instance_method" title="Ballast::Concerns::View#scope_css (method)">#scope_css</a></span>
|
380
386
|
<small>Ballast::Concerns::View</small>
|
381
387
|
</li>
|
382
388
|
|
383
389
|
|
384
|
-
<li class="
|
390
|
+
<li class="r1 ">
|
385
391
|
<span class='object_link'><a href="Ballast/AjaxResponse.html#status-instance_method" title="Ballast::AjaxResponse#status (method)">#status</a></span>
|
386
392
|
<small>Ballast::AjaxResponse</small>
|
387
393
|
</li>
|
388
394
|
|
389
395
|
|
390
|
-
<li class="
|
396
|
+
<li class="r2 ">
|
391
397
|
<span class='object_link'><a href="Ballast/Service/Response.html#success-instance_method" title="Ballast::Service::Response#success (method)">#success</a></span>
|
392
398
|
<small>Ballast::Service::Response</small>
|
393
399
|
</li>
|
394
400
|
|
395
401
|
|
396
|
-
<li class="
|
402
|
+
<li class="r1 ">
|
397
403
|
<span class='object_link'><a href="Ballast/Service/Response.html#success%3F-instance_method" title="Ballast::Service::Response#success? (method)">#success?</a></span>
|
398
404
|
<small>Ballast::Service::Response</small>
|
399
405
|
</li>
|
400
406
|
|
401
407
|
|
402
|
-
<li class="
|
408
|
+
<li class="r2 ">
|
403
409
|
<span class='object_link'><a href="Ballast/AjaxResponse.html#transport-instance_method" title="Ballast::AjaxResponse#transport (method)">#transport</a></span>
|
404
410
|
<small>Ballast::AjaxResponse</small>
|
405
411
|
</li>
|
406
412
|
|
407
413
|
|
408
|
-
<li class="
|
414
|
+
<li class="r1 ">
|
409
415
|
<span class='object_link'><a href="Ballast/Concerns/View.html#update_javascript_params-instance_method" title="Ballast::Concerns::View#update_javascript_params (method)">#update_javascript_params</a></span>
|
410
416
|
<small>Ballast::Concerns::View</small>
|
411
417
|
</li>
|
412
418
|
|
413
419
|
|
414
|
-
<li class="
|
420
|
+
<li class="r2 ">
|
415
421
|
<span class='object_link'><a href="Ballast/Concerns/View.html#update_layout_params-instance_method" title="Ballast::Concerns::View#update_layout_params (method)">#update_layout_params</a></span>
|
416
422
|
<small>Ballast::Concerns::View</small>
|
417
423
|
</li>
|
418
424
|
|
419
425
|
|
420
|
-
<li class="
|
426
|
+
<li class="r1 ">
|
421
427
|
<span class='object_link'><a href="Ballast/Emoji/Character.html#url-instance_method" title="Ballast::Emoji::Character#url (method)">#url</a></span>
|
422
428
|
<small>Ballast::Emoji::Character</small>
|
423
429
|
</li>
|
424
430
|
|
425
431
|
|
426
|
-
<li class="
|
432
|
+
<li class="r2 ">
|
427
433
|
<span class='object_link'><a href="Ballast/Emoji/Utils.html#url_for-instance_method" title="Ballast::Emoji::Utils#url_for (method)">#url_for</a></span>
|
428
434
|
<small>Ballast::Emoji::Utils</small>
|
429
435
|
</li>
|
430
436
|
|
431
437
|
|
432
|
-
<li class="
|
438
|
+
<li class="r1 ">
|
433
439
|
<span class='object_link'><a href="Ballast/Emoji/Utils.html#url_mapper-instance_method" title="Ballast::Emoji::Utils#url_mapper (method)">#url_mapper</a></span>
|
434
440
|
<small>Ballast::Emoji::Utils</small>
|
435
441
|
</li>
|
@@ -73,16 +73,8 @@
|
|
73
73
|
|
74
74
|
|
75
75
|
|
76
|
-
<dt class="r1">Extended by:</dt>
|
77
|
-
<dd class="r1"><span class='object_link'><a href="Ballast/Emoji/Utils.html" title="Ballast::Emoji::Utils (module)">Ballast::Emoji::Utils</a></span></dd>
|
78
|
-
|
79
|
-
|
80
76
|
|
81
77
|
|
82
|
-
<dt class="r2">Includes:</dt>
|
83
|
-
<dd class="r2"><span class='object_link'><a href="Ballast/Emoji/Character.html" title="Ballast::Emoji::Character (module)">Ballast::Emoji::Character</a></span></dd>
|
84
|
-
|
85
|
-
|
86
78
|
|
87
79
|
|
88
80
|
|
@@ -105,44 +97,15 @@
|
|
105
97
|
|
106
98
|
|
107
99
|
|
108
|
-
<h2>Instance Attribute Summary</h2>
|
109
|
-
|
110
|
-
<h3 class="inherited">Attributes included from <span class='object_link'><a href="Ballast/Emoji/Utils.html" title="Ballast::Emoji::Utils (module)">Ballast::Emoji::Utils</a></span></h3>
|
111
|
-
<p class="inherited"><span class='object_link'><a href="Ballast/Emoji/Utils.html#url_mapper-instance_method" title="Ballast::Emoji::Utils#url_mapper (method)">#url_mapper</a></span></p>
|
112
|
-
|
113
|
-
|
114
100
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<h2>Method Summary</h2>
|
122
|
-
|
123
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Ballast/Emoji/Utils.html" title="Ballast::Emoji::Utils (module)">Ballast::Emoji::Utils</a></span></h3>
|
124
|
-
<p class="inherited"><span class='object_link'><a href="Ballast/Emoji/Utils.html#enumerate-instance_method" title="Ballast::Emoji::Utils#enumerate (method)">enumerate</a></span>, <span class='object_link'><a href="Ballast/Emoji/Utils.html#replace-instance_method" title="Ballast::Emoji::Utils#replace (method)">replace</a></span>, <span class='object_link'><a href="Ballast/Emoji/Utils.html#replace_regex-instance_method" title="Ballast::Emoji::Utils#replace_regex (method)">replace_regex</a></span>, <span class='object_link'><a href="Ballast/Emoji/Utils.html#url_for-instance_method" title="Ballast::Emoji::Utils#url_for (method)">url_for</a></span></p>
|
125
101
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Ballast/Emoji/Character.html" title="Ballast::Emoji::Character (module)">Ballast::Emoji::Character</a></span></h3>
|
135
|
-
<p class="inherited"><span class='object_link'><a href="Ballast/Emoji/Character.html#image_tag-instance_method" title="Ballast::Emoji::Character#image_tag (method)">#image_tag</a></span>, <span class='object_link'><a href="Ballast/Emoji/Character.html#markup-instance_method" title="Ballast::Emoji::Character#markup (method)">#markup</a></span>, <span class='object_link'><a href="Ballast/Emoji/Character.html#url-instance_method" title="Ballast::Emoji::Character#url (method)">#url</a></span></p>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
102
|
|
140
103
|
</div>
|
141
104
|
|
142
105
|
<div id="footer">
|
143
|
-
Generated on
|
106
|
+
Generated on Sun Jan 18 13:27:08 2015 by
|
144
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
145
|
-
0.8.7.6 (ruby-2.
|
108
|
+
0.8.7.6 (ruby-2.2.0).
|
146
109
|
</div>
|
147
110
|
|
148
111
|
</body>
|
@@ -66,11 +66,16 @@ module Ballast
|
|
66
66
|
|
67
67
|
# :nodoc:
|
68
68
|
def format_reply(format)
|
69
|
-
format = (format
|
69
|
+
format = choose_format(format)
|
70
70
|
callback = [:jsonp, :pretty_jsonp].include?(format) ? (transport.params[:callback] || "jsonp#{Time.now.to_i}") : nil
|
71
71
|
content_type = (format == :text) ? "text/plain" : nil
|
72
72
|
|
73
73
|
[format, callback, content_type]
|
74
74
|
end
|
75
|
+
|
76
|
+
# :nodoc:
|
77
|
+
def choose_format(format)
|
78
|
+
(format || transport.params[:format] || transport.request.format || "json").to_sym
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|
@@ -7,6 +7,16 @@ module Ballast
|
|
7
7
|
module Concerns
|
8
8
|
# A concern to handle common tasks in an application.
|
9
9
|
module Common
|
10
|
+
# Executes a service.
|
11
|
+
#
|
12
|
+
# @param klass [Service] The service to execute.
|
13
|
+
# @param operation [String] The operation to invoke.
|
14
|
+
# @param kwargs [Hash] Parameters passed to the service.
|
15
|
+
# @return [Service::Response] The result of the invocation.
|
16
|
+
def perform_service(klass, operation = :perform, **kwargs)
|
17
|
+
@result = klass.new(self).call(operation, params: params, **kwargs)
|
18
|
+
end
|
19
|
+
|
10
20
|
# Checks if the current request wants JSON or JSONP as response.
|
11
21
|
#
|
12
22
|
# @return [Boolean] `true` if the request is JSON(P), `false` otherwise.
|
data/lib/ballast/errors.rb
CHANGED
data/lib/ballast/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
4
4
|
#
|
5
5
|
|
6
|
-
# A collection of base utilities for
|
6
|
+
# A collection of base utilities for web frameworks.
|
7
7
|
module Ballast
|
8
8
|
# The current version of ballast, according to semantic versioning.
|
9
9
|
#
|
@@ -13,10 +13,10 @@ module Ballast
|
|
13
13
|
MAJOR = 2
|
14
14
|
|
15
15
|
# The minor version.
|
16
|
-
MINOR =
|
16
|
+
MINOR = 1
|
17
17
|
|
18
18
|
# The patch version.
|
19
|
-
PATCH =
|
19
|
+
PATCH = 0
|
20
20
|
|
21
21
|
# The current version of ballast.
|
22
22
|
STRING = [MAJOR, MINOR, PATCH].compact.join(".")
|
@@ -10,8 +10,34 @@ describe Ballast::Concerns::Common do
|
|
10
10
|
include Ballast::Concerns::Common
|
11
11
|
end
|
12
12
|
|
13
|
+
class CommonMockService < Ballast::Service
|
14
|
+
def perform(params: params)
|
15
|
+
"OK"
|
16
|
+
end
|
17
|
+
|
18
|
+
def alternative(**kwargs)
|
19
|
+
kwargs
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
13
23
|
subject{ CommonMockClass.new(request: OpenStruct.new(headers: {}), headers: {}, params: {}, performed?: false) }
|
14
24
|
|
25
|
+
describe "#perform_service" do
|
26
|
+
it "should call a service and return it's result" do
|
27
|
+
expect(CommonMockClass.new.perform_service(CommonMockService).data).to eq("OK")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should forward parameters to the service" do
|
31
|
+
expect(CommonMockClass.new.perform_service(CommonMockService, :alternative, a: 1, b: 2).data).to eq({params: nil, a: 1, b: 2})
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should assign the result as instance variable" do
|
35
|
+
object = CommonMockClass.new
|
36
|
+
object.perform_service(CommonMockService)
|
37
|
+
expect(object.instance_variable_get(:@result)).to be_a(Ballast::Service::Response)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
15
41
|
describe "#json?" do
|
16
42
|
it "should return false by default" do
|
17
43
|
expect(CommonMockClass.new(request: OpenStruct.new({format: ""}), params: {}).json?).to be_falsey
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ballast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.0
|
61
|
+
version: '1.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gemoji
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,20 +161,6 @@ files:
|
|
161
161
|
- spec/ballast_spec.rb
|
162
162
|
- spec/coverage_helper.rb
|
163
163
|
- spec/spec_helper.rb
|
164
|
-
- tmp/saikuro/index_cyclo.html
|
165
|
-
- tmp/saikuro/lib/ballast.rb_cyclo.html
|
166
|
-
- tmp/saikuro/lib/ballast/concerns/ajax.rb_cyclo.html
|
167
|
-
- tmp/saikuro/lib/ballast/concerns/common.rb_cyclo.html
|
168
|
-
- tmp/saikuro/lib/ballast/concerns/errors_handling.rb_cyclo.html
|
169
|
-
- tmp/saikuro/lib/ballast/concerns/view.rb_cyclo.html
|
170
|
-
- tmp/saikuro/lib/ballast/configuration.rb_cyclo.html
|
171
|
-
- tmp/saikuro/lib/ballast/context.rb_cyclo.html
|
172
|
-
- tmp/saikuro/lib/ballast/errors.rb_cyclo.html
|
173
|
-
- tmp/saikuro/lib/ballast/middlewares/default_host.rb_cyclo.html
|
174
|
-
- tmp/saikuro/lib/ballast/operation.rb_cyclo.html
|
175
|
-
- tmp/saikuro/lib/ballast/operations_chain.rb_cyclo.html
|
176
|
-
- tmp/saikuro/lib/ballast/request_domain_matcher.rb_cyclo.html
|
177
|
-
- tmp/saikuro/lib/ballast/version.rb_cyclo.html
|
178
164
|
homepage: http://sw.cowtech.it/ballast
|
179
165
|
licenses:
|
180
166
|
- MIT
|
@@ -195,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
181
|
version: '0'
|
196
182
|
requirements: []
|
197
183
|
rubyforge_project: ballast
|
198
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.5
|
199
185
|
signing_key:
|
200
186
|
specification_version: 4
|
201
187
|
summary: A collection of base utilities for web frameworks.
|