ballast 1.4.0 → 1.5.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/CHANGELOG.md +5 -1
- data/doc/Ballast.html +1 -1
- data/doc/Ballast/Concerns.html +1 -1
- data/doc/Ballast/Concerns/Ajax.html +2 -2
- data/doc/Ballast/Concerns/Common.html +122 -42
- data/doc/Ballast/Concerns/ErrorsHandling.html +1 -1
- data/doc/Ballast/Concerns/View.html +1 -1
- data/doc/Ballast/Configuration.html +1 -1
- data/doc/Ballast/Context.html +1 -1
- data/doc/Ballast/Errors.html +1 -1
- data/doc/Ballast/Errors/BaseError.html +1 -1
- data/doc/Ballast/Errors/InvalidDomain.html +1 -1
- data/doc/Ballast/Errors/PerformError.html +1 -1
- data/doc/Ballast/Errors/ValidationError.html +1 -1
- data/doc/Ballast/Middlewares.html +1 -1
- data/doc/Ballast/Middlewares/DefaultHost.html +1 -1
- data/doc/Ballast/Operation.html +1 -1
- data/doc/Ballast/OperationsChain.html +1 -1
- data/doc/Ballast/RequestDomainMatcher.html +1 -1
- data/doc/Ballast/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +41 -35
- data/doc/top-level-namespace.html +1 -1
- data/lib/ballast/concerns/ajax.rb +1 -1
- data/lib/ballast/concerns/common.rb +7 -0
- data/lib/ballast/version.rb +1 -1
- data/spec/ballast/concerns/common_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd59bbb0c6206ad0a3389ea19f5832b069080841
|
|
4
|
+
data.tar.gz: b162883d21ad6f5661d7e1ba324766e78eb87432
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd120366facef08cd59d4b9e0e667a7ae0859d27d47bbe56780f0bcfdd3d7787506c370fc966235f9042b6c6053a450ed01c1f531cbd209134cff3fef4f6871b
|
|
7
|
+
data.tar.gz: 08469e4cbdda11b1c528ce5c4bda41c3056a0aaa2af1c9985318f2c691ca756a9a491b6f42f1a9339fadcfb6cae2407e039a4427f8de9cc286e8231d9deeee84
|
data/CHANGELOG.md
CHANGED
data/doc/Ballast.html
CHANGED
|
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
|
121
121
|
</div>
|
|
122
122
|
|
|
123
123
|
<div id="footer">
|
|
124
|
-
Generated on Sat Jan 4 10:
|
|
124
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
126
126
|
0.8.7.3 (ruby-2.1.0).
|
|
127
127
|
</div>
|
data/doc/Ballast/Concerns.html
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
</div>
|
|
119
119
|
|
|
120
120
|
<div id="footer">
|
|
121
|
-
Generated on Sat Jan 4 10:
|
|
121
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
123
123
|
0.8.7.3 (ruby-2.1.0).
|
|
124
124
|
</div>
|
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/ajax.rb', line 16</span>
|
|
425
425
|
|
|
426
426
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_ajax?'>is_ajax?</span>
|
|
427
|
-
<span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:xhr?</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_xhr?'>xhr?</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:xhr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span>
|
|
427
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:xhr?</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_xhr?'>xhr?</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:xhr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
|
428
428
|
<span class='kw'>end</span></pre>
|
|
429
429
|
</td>
|
|
430
430
|
</tr>
|
|
@@ -797,7 +797,7 @@
|
|
|
797
797
|
</div>
|
|
798
798
|
|
|
799
799
|
<div id="footer">
|
|
800
|
-
Generated on Sat Jan 4 10:
|
|
800
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
801
801
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
802
802
|
0.8.7.3 (ruby-2.1.0).
|
|
803
803
|
</div>
|
|
@@ -198,6 +198,29 @@
|
|
|
198
198
|
<span class="summary_desc"><div class='inline'><p>Formats a relative date using abbreviation or short formats.</p>
|
|
199
199
|
</div></span>
|
|
200
200
|
|
|
201
|
+
</li>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
<li class="public ">
|
|
205
|
+
<span class="summary_signature">
|
|
206
|
+
|
|
207
|
+
<a href="#is_json%3F-instance_method" title="#is_json? (instance method)">- (Boolean) <strong>is_json?</strong> </a>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
</span>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the current request wants JSON or JSONP as response.</p>
|
|
222
|
+
</div></span>
|
|
223
|
+
|
|
201
224
|
</li>
|
|
202
225
|
|
|
203
226
|
|
|
@@ -351,20 +374,20 @@
|
|
|
351
374
|
<pre class="lines">
|
|
352
375
|
|
|
353
376
|
|
|
354
|
-
81
|
|
355
|
-
82
|
|
356
|
-
83
|
|
357
|
-
84
|
|
358
|
-
85
|
|
359
|
-
86
|
|
360
|
-
87
|
|
361
377
|
88
|
|
362
378
|
89
|
|
363
379
|
90
|
|
364
|
-
91
|
|
380
|
+
91
|
|
381
|
+
92
|
|
382
|
+
93
|
|
383
|
+
94
|
|
384
|
+
95
|
|
385
|
+
96
|
|
386
|
+
97
|
|
387
|
+
98</pre>
|
|
365
388
|
</td>
|
|
366
389
|
<td>
|
|
367
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
390
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 88</span>
|
|
368
391
|
|
|
369
392
|
<span class='kw'>def</span> <span class='id identifier rubyid_authenticate_user'>authenticate_user</span><span class='lparen'>(</span><span class='id identifier rubyid_area'>area</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_authenticator'>authenticator</span><span class='rparen'>)</span>
|
|
370
393
|
<span class='id identifier rubyid_area'>area</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Private Area</span><span class='tstring_end'>"</span></span>
|
|
@@ -461,14 +484,14 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
461
484
|
<pre class="lines">
|
|
462
485
|
|
|
463
486
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
487
|
+
76
|
|
488
|
+
77
|
|
489
|
+
78
|
|
490
|
+
79
|
|
491
|
+
80</pre>
|
|
469
492
|
</td>
|
|
470
493
|
<td>
|
|
471
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
494
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 76</span>
|
|
472
495
|
|
|
473
496
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_long_date'>format_long_date</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>•</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%I:%M%p %- %b %o, %Y (%:Z)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
474
497
|
<span class='id identifier rubyid_tz'>tz</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_zone'>zone</span>
|
|
@@ -558,18 +581,18 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
558
581
|
<pre class="lines">
|
|
559
582
|
|
|
560
583
|
|
|
561
|
-
53
|
|
562
|
-
54
|
|
563
|
-
55
|
|
564
|
-
56
|
|
565
|
-
57
|
|
566
|
-
58
|
|
567
|
-
59
|
|
568
584
|
60
|
|
569
|
-
61
|
|
585
|
+
61
|
|
586
|
+
62
|
|
587
|
+
63
|
|
588
|
+
64
|
|
589
|
+
65
|
|
590
|
+
66
|
|
591
|
+
67
|
|
592
|
+
68</pre>
|
|
570
593
|
</td>
|
|
571
594
|
<td>
|
|
572
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
595
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 60</span>
|
|
573
596
|
|
|
574
597
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_short_amount'>format_short_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
575
598
|
<span class='kw'>if</span> <span class='id identifier rubyid_amount'>amount</span> <span class='op'><</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_minute'>minute</span> <span class='kw'>then</span>
|
|
@@ -680,23 +703,23 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
680
703
|
<pre class="lines">
|
|
681
704
|
|
|
682
705
|
|
|
683
|
-
33
|
|
684
|
-
34
|
|
685
|
-
35
|
|
686
|
-
36
|
|
687
|
-
37
|
|
688
|
-
38
|
|
689
|
-
39
|
|
690
706
|
40
|
|
691
707
|
41
|
|
692
708
|
42
|
|
693
709
|
43
|
|
694
710
|
44
|
|
695
711
|
45
|
|
696
|
-
46
|
|
712
|
+
46
|
|
713
|
+
47
|
|
714
|
+
48
|
|
715
|
+
49
|
|
716
|
+
50
|
|
717
|
+
51
|
|
718
|
+
52
|
|
719
|
+
53</pre>
|
|
697
720
|
</td>
|
|
698
721
|
<td>
|
|
699
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
722
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 40</span>
|
|
700
723
|
|
|
701
724
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_short_duration'>format_short_duration</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
702
725
|
<span class='id identifier rubyid_reference'>reference</span> <span class='op'>||=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
|
@@ -715,6 +738,63 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
715
738
|
</td>
|
|
716
739
|
</tr>
|
|
717
740
|
</table>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
<div class="method_details ">
|
|
744
|
+
<h3 class="signature " id="is_json?-instance_method">
|
|
745
|
+
|
|
746
|
+
- (<tt>Boolean</tt>) <strong>is_json?</strong>
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
</h3><div class="docstring">
|
|
753
|
+
<div class="discussion">
|
|
754
|
+
<p>Checks if the current request wants JSON or JSONP as response.</p>
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
</div>
|
|
758
|
+
</div>
|
|
759
|
+
<div class="tags">
|
|
760
|
+
|
|
761
|
+
<p class="tag_title">Returns:</p>
|
|
762
|
+
<ul class="return">
|
|
763
|
+
|
|
764
|
+
<li>
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
—
|
|
772
|
+
<div class='inline'><p><code>true</code> if the request is JSON, <code>false</code> otherwise.</p>
|
|
773
|
+
</div>
|
|
774
|
+
|
|
775
|
+
</li>
|
|
776
|
+
|
|
777
|
+
</ul>
|
|
778
|
+
|
|
779
|
+
</div><table class="source_code">
|
|
780
|
+
<tr>
|
|
781
|
+
<td>
|
|
782
|
+
<pre class="lines">
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
13
|
|
786
|
+
14
|
|
787
|
+
15</pre>
|
|
788
|
+
</td>
|
|
789
|
+
<td>
|
|
790
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 13</span>
|
|
791
|
+
|
|
792
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_json?'>is_json?</span>
|
|
793
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^json</span><span class='regexp_end'>/</span></span> <span class='op'>||</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:json</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
|
794
|
+
<span class='kw'>end</span></pre>
|
|
795
|
+
</td>
|
|
796
|
+
</tr>
|
|
797
|
+
</table>
|
|
718
798
|
</div>
|
|
719
799
|
|
|
720
800
|
<div class="method_details ">
|
|
@@ -810,12 +890,12 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
810
890
|
<pre class="lines">
|
|
811
891
|
|
|
812
892
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
893
|
+
30
|
|
894
|
+
31
|
|
895
|
+
32</pre>
|
|
816
896
|
</td>
|
|
817
897
|
<td>
|
|
818
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
898
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 30</span>
|
|
819
899
|
|
|
820
900
|
<span class='kw'>def</span> <span class='id identifier rubyid_perform_operation'>perform_operation</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_owner'>owner</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
|
821
901
|
<span class='ivar'>@operation</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_owner'>owner</span> <span class='op'>||</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
|
@@ -867,12 +947,12 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
867
947
|
<pre class="lines">
|
|
868
948
|
|
|
869
949
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
950
|
+
20
|
|
951
|
+
21
|
|
952
|
+
22</pre>
|
|
873
953
|
</td>
|
|
874
954
|
<td>
|
|
875
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line
|
|
955
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/common.rb', line 20</span>
|
|
876
956
|
|
|
877
957
|
<span class='kw'>def</span> <span class='id identifier rubyid_sending_data?'>sending_data?</span>
|
|
878
958
|
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_post?'>post?</span> <span class='op'>||</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_put?'>put?</span>
|
|
@@ -887,7 +967,7 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
|
887
967
|
</div>
|
|
888
968
|
|
|
889
969
|
<div id="footer">
|
|
890
|
-
Generated on Sat Jan 4 10:
|
|
970
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
891
971
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
892
972
|
0.8.7.3 (ruby-2.1.0).
|
|
893
973
|
</div>
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
</div>
|
|
292
292
|
|
|
293
293
|
<div id="footer">
|
|
294
|
-
Generated on Sat Jan 4 10:
|
|
294
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
295
295
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
296
296
|
0.8.7.3 (ruby-2.1.0).
|
|
297
297
|
</div>
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
</div>
|
|
639
639
|
|
|
640
640
|
<div id="footer">
|
|
641
|
-
Generated on Sat Jan 4 10:
|
|
641
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
642
642
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
643
643
|
0.8.7.3 (ruby-2.1.0).
|
|
644
644
|
</div>
|
|
@@ -273,7 +273,7 @@ Subfolders are not supported.</p>
|
|
|
273
273
|
</div>
|
|
274
274
|
|
|
275
275
|
<div id="footer">
|
|
276
|
-
Generated on Sat Jan 4 10:
|
|
276
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
277
277
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
278
278
|
0.8.7.3 (ruby-2.1.0).
|
|
279
279
|
</div>
|
data/doc/Ballast/Context.html
CHANGED
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
</div>
|
|
409
409
|
|
|
410
410
|
<div id="footer">
|
|
411
|
-
Generated on Sat Jan 4 10:
|
|
411
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
412
412
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
413
413
|
0.8.7.3 (ruby-2.1.0).
|
|
414
414
|
</div>
|
data/doc/Ballast/Errors.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on Sat Jan 4 10:
|
|
119
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.8.7.3 (ruby-2.1.0).
|
|
122
122
|
</div>
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
</div>
|
|
318
318
|
|
|
319
319
|
<div id="footer">
|
|
320
|
-
Generated on Sat Jan 4 10:
|
|
320
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
321
321
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
322
322
|
0.8.7.3 (ruby-2.1.0).
|
|
323
323
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on Sat Jan 4 10:
|
|
151
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.3 (ruby-2.1.0).
|
|
154
154
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on Sat Jan 4 10:
|
|
151
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.3 (ruby-2.1.0).
|
|
154
154
|
</div>
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div id="footer">
|
|
151
|
-
Generated on Sat Jan 4 10:
|
|
151
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
153
153
|
0.8.7.3 (ruby-2.1.0).
|
|
154
154
|
</div>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on Sat Jan 4 10:
|
|
119
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.8.7.3 (ruby-2.1.0).
|
|
122
122
|
</div>
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
</div>
|
|
346
346
|
|
|
347
347
|
<div id="footer">
|
|
348
|
-
Generated on Sat Jan 4 10:
|
|
348
|
+
Generated on Sat Jan 4 10:24:05 2014 by
|
|
349
349
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
350
350
|
0.8.7.3 (ruby-2.1.0).
|
|
351
351
|
</div>
|
data/doc/Ballast/Operation.html
CHANGED
|
@@ -1295,7 +1295,7 @@ as owner will be created.</p>
|
|
|
1295
1295
|
</div>
|
|
1296
1296
|
|
|
1297
1297
|
<div id="footer">
|
|
1298
|
-
Generated on Sat Jan 4 10:
|
|
1298
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
1299
1299
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1300
1300
|
0.8.7.3 (ruby-2.1.0).
|
|
1301
1301
|
</div>
|
|
@@ -576,7 +576,7 @@ as owner will be created.</p>
|
|
|
576
576
|
</div>
|
|
577
577
|
|
|
578
578
|
<div id="footer">
|
|
579
|
-
Generated on Sat Jan 4 10:
|
|
579
|
+
Generated on Sat Jan 4 10:24:05 2014 by
|
|
580
580
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
581
581
|
0.8.7.3 (ruby-2.1.0).
|
|
582
582
|
</div>
|
|
@@ -908,7 +908,7 @@
|
|
|
908
908
|
</div>
|
|
909
909
|
|
|
910
910
|
<div id="footer">
|
|
911
|
-
Generated on Sat Jan 4 10:
|
|
911
|
+
Generated on Sat Jan 4 10:24:05 2014 by
|
|
912
912
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
913
913
|
0.8.7.3 (ruby-2.1.0).
|
|
914
914
|
</div>
|
data/doc/Ballast/Version.html
CHANGED
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
|
|
135
135
|
</div>
|
|
136
136
|
</dt>
|
|
137
|
-
<dd><pre class="code"><span class='int'>
|
|
137
|
+
<dd><pre class="code"><span class='int'>5</span></pre></dd>
|
|
138
138
|
|
|
139
139
|
<dt id="PATCH-constant" class="">PATCH =
|
|
140
140
|
<div class="docstring">
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<div id="footer">
|
|
183
|
-
Generated on Sat Jan 4 10:
|
|
183
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
185
185
|
0.8.7.3 (ruby-2.1.0).
|
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
</div>
|
|
311
311
|
|
|
312
312
|
<div id="footer">
|
|
313
|
-
Generated on Sat Jan 4 10:
|
|
313
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
314
314
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
315
315
|
0.8.7.3 (ruby-2.1.0).
|
|
316
316
|
</div>
|
data/doc/file.README.html
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</div></div>
|
|
107
107
|
|
|
108
108
|
<div id="footer">
|
|
109
|
-
Generated on Sat Jan 4 10:
|
|
109
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
111
111
|
0.8.7.3 (ruby-2.1.0).
|
|
112
112
|
</div>
|
data/doc/index.html
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</div></div>
|
|
107
107
|
|
|
108
108
|
<div id="footer">
|
|
109
|
-
Generated on Sat Jan 4 10:
|
|
109
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
111
111
|
0.8.7.3 (ruby-2.1.0).
|
|
112
112
|
</div>
|
data/doc/method_list.html
CHANGED
|
@@ -150,38 +150,38 @@
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
<li class="r2 ">
|
|
153
|
-
<span class='object_link'><a href="Ballast/
|
|
154
|
-
<small>Ballast::
|
|
153
|
+
<span class='object_link'><a href="Ballast/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
|
|
154
|
+
<small>Ballast::OperationsChain</small>
|
|
155
155
|
</li>
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
<li class="r1 ">
|
|
159
|
-
<span class='object_link'><a href="Ballast/
|
|
160
|
-
<small>Ballast::
|
|
159
|
+
<span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#initialize-instance_method" title="Ballast::Middlewares::DefaultHost#initialize (method)">#initialize</a></span>
|
|
160
|
+
<small>Ballast::Middlewares::DefaultHost</small>
|
|
161
161
|
</li>
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
<li class="r2 ">
|
|
165
|
-
<span class='object_link'><a href="Ballast/
|
|
166
|
-
<small>Ballast::
|
|
165
|
+
<span class='object_link'><a href="Ballast/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
|
|
166
|
+
<small>Ballast::Configuration</small>
|
|
167
167
|
</li>
|
|
168
168
|
|
|
169
169
|
|
|
170
170
|
<li class="r1 ">
|
|
171
|
-
<span class='object_link'><a href="Ballast/
|
|
172
|
-
<small>Ballast::
|
|
171
|
+
<span class='object_link'><a href="Ballast/Errors/BaseError.html#initialize-instance_method" title="Ballast::Errors::BaseError#initialize (method)">#initialize</a></span>
|
|
172
|
+
<small>Ballast::Errors::BaseError</small>
|
|
173
173
|
</li>
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
<li class="r2 ">
|
|
177
|
-
<span class='object_link'><a href="Ballast/
|
|
178
|
-
<small>Ballast::
|
|
177
|
+
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
|
|
178
|
+
<small>Ballast::RequestDomainMatcher</small>
|
|
179
179
|
</li>
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
<li class="r1 ">
|
|
183
|
-
<span class='object_link'><a href="Ballast/
|
|
184
|
-
<small>Ballast::
|
|
183
|
+
<span class='object_link'><a href="Ballast/Operation.html#initialize-instance_method" title="Ballast::Operation#initialize (method)">#initialize</a></span>
|
|
184
|
+
<small>Ballast::Operation</small>
|
|
185
185
|
</li>
|
|
186
186
|
|
|
187
187
|
|
|
@@ -192,37 +192,37 @@
|
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
<li class="r1 ">
|
|
195
|
+
<span class='object_link'><a href="Ballast/Concerns/Common.html#is_json%3F-instance_method" title="Ballast::Concerns::Common#is_json? (method)">#is_json?</a></span>
|
|
196
|
+
<small>Ballast::Concerns::Common</small>
|
|
197
|
+
</li>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<li class="r2 ">
|
|
195
201
|
<span class='object_link'><a href="Ballast/Concerns/View.html#javascript_params-instance_method" title="Ballast::Concerns::View#javascript_params (method)">#javascript_params</a></span>
|
|
196
202
|
<small>Ballast::Concerns::View</small>
|
|
197
203
|
</li>
|
|
198
204
|
|
|
199
205
|
|
|
200
|
-
<li class="
|
|
206
|
+
<li class="r1 ">
|
|
201
207
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#matches%3F-instance_method" title="Ballast::RequestDomainMatcher#matches? (method)">#matches?</a></span>
|
|
202
208
|
<small>Ballast::RequestDomainMatcher</small>
|
|
203
209
|
</li>
|
|
204
210
|
|
|
205
211
|
|
|
206
|
-
<li class="
|
|
212
|
+
<li class="r2 ">
|
|
207
213
|
<span class='object_link'><a href="Ballast/Context.html#method_missing-instance_method" title="Ballast::Context#method_missing (method)">#method_missing</a></span>
|
|
208
214
|
<small>Ballast::Context</small>
|
|
209
215
|
</li>
|
|
210
216
|
|
|
211
217
|
|
|
212
|
-
<li class="
|
|
218
|
+
<li class="r1 ">
|
|
213
219
|
<span class='object_link'><a href="Ballast/Operation.html#method_missing-instance_method" title="Ballast::Operation#method_missing (method)">#method_missing</a></span>
|
|
214
220
|
<small>Ballast::Operation</small>
|
|
215
221
|
</li>
|
|
216
222
|
|
|
217
223
|
|
|
218
|
-
<li class="r1 ">
|
|
219
|
-
<span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
|
|
220
|
-
<small>Ballast::OperationsChain</small>
|
|
221
|
-
</li>
|
|
222
|
-
|
|
223
|
-
|
|
224
224
|
<li class="r2 ">
|
|
225
|
-
<span class='object_link'><a href="Ballast/OperationsChain.html#
|
|
225
|
+
<span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
|
|
226
226
|
<small>Ballast::OperationsChain</small>
|
|
227
227
|
</li>
|
|
228
228
|
|
|
@@ -234,84 +234,90 @@
|
|
|
234
234
|
|
|
235
235
|
|
|
236
236
|
<li class="r2 ">
|
|
237
|
+
<span class='object_link'><a href="Ballast/OperationsChain.html#perform-class_method" title="Ballast::OperationsChain.perform (method)">perform</a></span>
|
|
238
|
+
<small>Ballast::OperationsChain</small>
|
|
239
|
+
</li>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
<li class="r1 ">
|
|
237
243
|
<span class='object_link'><a href="Ballast/Concerns/Common.html#perform_operation-instance_method" title="Ballast::Concerns::Common#perform_operation (method)">#perform_operation</a></span>
|
|
238
244
|
<small>Ballast::Concerns::Common</small>
|
|
239
245
|
</li>
|
|
240
246
|
|
|
241
247
|
|
|
242
|
-
<li class="
|
|
248
|
+
<li class="r2 ">
|
|
243
249
|
<span class='object_link'><a href="Ballast/Operation.html#perform_with_handling-instance_method" title="Ballast::Operation#perform_with_handling (method)">#perform_with_handling</a></span>
|
|
244
250
|
<small>Ballast::Operation</small>
|
|
245
251
|
</li>
|
|
246
252
|
|
|
247
253
|
|
|
248
|
-
<li class="
|
|
254
|
+
<li class="r1 ">
|
|
249
255
|
<span class='object_link'><a href="Ballast/Concerns/Ajax.html#prepare_ajax-instance_method" title="Ballast::Concerns::Ajax#prepare_ajax (method)">#prepare_ajax</a></span>
|
|
250
256
|
<small>Ballast::Concerns::Ajax</small>
|
|
251
257
|
</li>
|
|
252
258
|
|
|
253
259
|
|
|
254
|
-
<li class="
|
|
260
|
+
<li class="r2 ">
|
|
255
261
|
<span class='object_link'><a href="Ballast/Concerns/Ajax.html#prevent_caching-instance_method" title="Ballast::Concerns::Ajax#prevent_caching (method)">#prevent_caching</a></span>
|
|
256
262
|
<small>Ballast::Concerns::Ajax</small>
|
|
257
263
|
</li>
|
|
258
264
|
|
|
259
265
|
|
|
260
|
-
<li class="
|
|
266
|
+
<li class="r1 ">
|
|
261
267
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
|
|
262
268
|
<small>Ballast::RequestDomainMatcher</small>
|
|
263
269
|
</li>
|
|
264
270
|
|
|
265
271
|
|
|
266
|
-
<li class="
|
|
272
|
+
<li class="r2 ">
|
|
267
273
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
|
|
268
274
|
<small>Ballast::RequestDomainMatcher</small>
|
|
269
275
|
</li>
|
|
270
276
|
|
|
271
277
|
|
|
272
|
-
<li class="
|
|
278
|
+
<li class="r1 ">
|
|
273
279
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
|
|
274
280
|
<small>Ballast::RequestDomainMatcher</small>
|
|
275
281
|
</li>
|
|
276
282
|
|
|
277
283
|
|
|
278
|
-
<li class="
|
|
284
|
+
<li class="r2 ">
|
|
279
285
|
<span class='object_link'><a href="Ballast/Operation.html#resolve_error-instance_method" title="Ballast::Operation#resolve_error (method)">#resolve_error</a></span>
|
|
280
286
|
<small>Ballast::Operation</small>
|
|
281
287
|
</li>
|
|
282
288
|
|
|
283
289
|
|
|
284
|
-
<li class="
|
|
290
|
+
<li class="r1 ">
|
|
285
291
|
<span class='object_link'><a href="Ballast/Errors/BaseError.html#response-instance_method" title="Ballast::Errors::BaseError#response (method)">#response</a></span>
|
|
286
292
|
<small>Ballast::Errors::BaseError</small>
|
|
287
293
|
</li>
|
|
288
294
|
|
|
289
295
|
|
|
290
|
-
<li class="
|
|
296
|
+
<li class="r2 ">
|
|
291
297
|
<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>
|
|
292
298
|
<small>Ballast::Concerns::View</small>
|
|
293
299
|
</li>
|
|
294
300
|
|
|
295
301
|
|
|
296
|
-
<li class="
|
|
302
|
+
<li class="r1 ">
|
|
297
303
|
<span class='object_link'><a href="Ballast/Concerns/Ajax.html#send_ajax-instance_method" title="Ballast::Concerns::Ajax#send_ajax (method)">#send_ajax</a></span>
|
|
298
304
|
<small>Ballast::Concerns::Ajax</small>
|
|
299
305
|
</li>
|
|
300
306
|
|
|
301
307
|
|
|
302
|
-
<li class="
|
|
308
|
+
<li class="r2 ">
|
|
303
309
|
<span class='object_link'><a href="Ballast/Concerns/Common.html#sending_data%3F-instance_method" title="Ballast::Concerns::Common#sending_data? (method)">#sending_data?</a></span>
|
|
304
310
|
<small>Ballast::Concerns::Common</small>
|
|
305
311
|
</li>
|
|
306
312
|
|
|
307
313
|
|
|
308
|
-
<li class="
|
|
314
|
+
<li class="r1 ">
|
|
309
315
|
<span class='object_link'><a href="Ballast/Operation.html#setup_response-instance_method" title="Ballast::Operation#setup_response (method)">#setup_response</a></span>
|
|
310
316
|
<small>Ballast::Operation</small>
|
|
311
317
|
</li>
|
|
312
318
|
|
|
313
319
|
|
|
314
|
-
<li class="
|
|
320
|
+
<li class="r2 ">
|
|
315
321
|
<span class='object_link'><a href="Ballast/Concerns/Ajax.html#update_ajax-instance_method" title="Ballast::Concerns::Ajax#update_ajax (method)">#update_ajax</a></span>
|
|
316
322
|
<small>Ballast::Concerns::Ajax</small>
|
|
317
323
|
</li>
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<div id="footer">
|
|
106
|
-
Generated on Sat Jan 4 10:
|
|
106
|
+
Generated on Sat Jan 4 10:24:04 2014 by
|
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
108
108
|
0.8.7.3 (ruby-2.1.0).
|
|
109
109
|
</div>
|
|
@@ -14,7 +14,7 @@ module Ballast
|
|
|
14
14
|
#
|
|
15
15
|
# @return [Boolean] `true` if the request is AJAX, `false` otherwise.
|
|
16
16
|
def is_ajax?
|
|
17
|
-
(request.respond_to?(:xhr?) && request.xhr?) || params[:xhr].to_boolean
|
|
17
|
+
(request.respond_to?(:xhr?) && request.xhr?) || params[:xhr].to_boolean ? true : false
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# Prepares an AJAX response.
|
|
@@ -7,6 +7,13 @@ module Ballast
|
|
|
7
7
|
module Concerns
|
|
8
8
|
# A concern to handle common tasks in an application.
|
|
9
9
|
module Common
|
|
10
|
+
# Checks if the current request wants JSON or JSONP as response.
|
|
11
|
+
#
|
|
12
|
+
# @return [Boolean] `true` if the request is JSON, `false` otherwise.
|
|
13
|
+
def is_json?
|
|
14
|
+
request.format.to_s =~ /^json/ || params[:json].to_boolean ? true : false
|
|
15
|
+
end
|
|
16
|
+
|
|
10
17
|
# Checks if the user is sending any data.
|
|
11
18
|
#
|
|
12
19
|
# @return [Boolean] `true` if the user is sending data, `false` otherwise.
|
data/lib/ballast/version.rb
CHANGED
|
@@ -23,6 +23,20 @@ describe Ballast::Concerns::Common do
|
|
|
23
23
|
|
|
24
24
|
subject{ CommonMockClass.new(request: OpenStruct.new(headers: {}), headers: {}, params: {}, performed?: false) }
|
|
25
25
|
|
|
26
|
+
describe "#is_json?" do
|
|
27
|
+
it "should return false by default" do
|
|
28
|
+
expect(CommonMockClass.new(request: OpenStruct.new({format: ""}), params: {}).is_json?).to be(false)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should return true when the request is JSON" do
|
|
32
|
+
expect(CommonMockClass.new(request: OpenStruct.new(format: "json")).is_json?).to be(true)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should return true when the parameter is overriden" do
|
|
36
|
+
expect(CommonMockClass.new(request: OpenStruct.new({format: ""}), params: {json: true}).is_json?).to be(true)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
26
40
|
describe "#sending_data?" do
|
|
27
41
|
it "should return the current status" do
|
|
28
42
|
expect(CommonMockClass.new(request: OpenStruct.new(post?: false, put?: false)).sending_data?).to be(false)
|