ballast 1.7.0 → 1.8.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 +4 -0
- data/doc/Ballast.html +113 -2
- data/doc/Ballast/Concerns.html +1 -1
- data/doc/Ballast/Concerns/Ajax.html +1 -1
- data/doc/Ballast/Concerns/Common.html +1 -1
- 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 +2 -2
- 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 +40 -34
- data/doc/top-level-namespace.html +1 -1
- data/lib/ballast.rb +16 -1
- data/lib/ballast/operation.rb +1 -1
- data/lib/ballast/version.rb +1 -1
- data/spec/ballast/operation_spec.rb +3 -1
- data/spec/ballast_spec.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c802071fba8b05babb9c4577a90ac4e57f62c8c
|
4
|
+
data.tar.gz: ce018497207921be1527567a4d6ef4e7f3733675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1e9bf785dc3ffb8aed3a4d0969b32cd8a12df3bd9b216e0555eafec957c19c375e24e4a4c144ab552e3d73d8f21e9c42de72abdae41e2fd95f03b9b284aa016
|
7
|
+
data.tar.gz: 97c56b3504e4e9573e97866def360a22cf9a926c56efcf78d27175f0d434a32aeb5a78936e88ff10d537928795ac6d9c3c4e96c488ebc501e1c14f12c3931184
|
data/CHANGELOG.md
CHANGED
data/doc/Ballast.html
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
82
82
|
<dd class="r1 last">lib/ballast/errors.rb<span class="defines">,<br />
|
83
|
-
lib/ballast/version.rb,<br /> lib/ballast/context.rb,<br /> lib/ballast/operation.rb,<br /> lib/ballast/configuration.rb,<br /> lib/ballast/concerns/view.rb,<br /> lib/ballast/concerns/ajax.rb,<br /> lib/ballast/concerns/common.rb,<br /> lib/ballast/operations_chain.rb,<br /> lib/ballast/request_domain_matcher.rb,<br /> lib/ballast/middlewares/default_host.rb,<br /> lib/ballast/concerns/errors_handling.rb</span>
|
83
|
+
lib/ballast.rb,<br /> lib/ballast/version.rb,<br /> lib/ballast/context.rb,<br /> lib/ballast/operation.rb,<br /> lib/ballast/configuration.rb,<br /> lib/ballast/concerns/view.rb,<br /> lib/ballast/concerns/ajax.rb,<br /> lib/ballast/concerns/common.rb,<br /> lib/ballast/operations_chain.rb,<br /> lib/ballast/request_domain_matcher.rb,<br /> lib/ballast/middlewares/default_host.rb,<br /> lib/ballast/concerns/errors_handling.rb</span>
|
84
84
|
</dd>
|
85
85
|
|
86
86
|
</dl>
|
@@ -116,12 +116,123 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
116
116
|
|
117
117
|
|
118
118
|
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Class Method Summary
|
122
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<ul class="summary">
|
126
|
+
|
127
|
+
<li class="public ">
|
128
|
+
<span class="summary_signature">
|
129
|
+
|
130
|
+
<a href="#in_em_thread-class_method" title="in_em_thread (class method)">+ (Object) <strong>in_em_thread</strong>(&block) </a>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc"><div class='inline'><p>If running under eventmachine, run the block in a thread of its threadpool using EM::Synchrony, otherwise run the block normally.</p>
|
145
|
+
</div></span>
|
146
|
+
|
147
|
+
</li>
|
148
|
+
|
149
|
+
|
150
|
+
</ul>
|
151
|
+
|
152
|
+
|
119
153
|
|
120
154
|
|
155
|
+
<div id="class_method_details" class="method_details_list">
|
156
|
+
<h2>Class Method Details</h2>
|
157
|
+
|
158
|
+
|
159
|
+
<div class="method_details first">
|
160
|
+
<h3 class="signature first" id="in_em_thread-class_method">
|
161
|
+
|
162
|
+
+ (<tt>Object</tt>) <strong>in_em_thread</strong>(&block)
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</h3><div class="docstring">
|
169
|
+
<div class="discussion">
|
170
|
+
<p>If running under eventmachine, run the block in a thread of its threadpool using EM::Synchrony, otherwise run the block normally.</p>
|
171
|
+
|
172
|
+
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
<div class="tags">
|
176
|
+
<p class="tag_title">Parameters:</p>
|
177
|
+
<ul class="param">
|
178
|
+
|
179
|
+
<li>
|
180
|
+
|
181
|
+
<span class='name'>block</span>
|
182
|
+
|
183
|
+
|
184
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
—
|
189
|
+
<div class='inline'><p>The block to run.</p>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
</ul>
|
195
|
+
|
196
|
+
|
197
|
+
</div><table class="source_code">
|
198
|
+
<tr>
|
199
|
+
<td>
|
200
|
+
<pre class="lines">
|
201
|
+
|
202
|
+
|
203
|
+
35
|
204
|
+
36
|
205
|
+
37
|
206
|
+
38
|
207
|
+
39
|
208
|
+
40
|
209
|
+
41
|
210
|
+
42
|
211
|
+
43</pre>
|
212
|
+
</td>
|
213
|
+
<td>
|
214
|
+
<pre class="code"><span class="info file"># File 'lib/ballast.rb', line 35</span>
|
215
|
+
|
216
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_in_em_thread'>in_em_thread</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
217
|
+
<span class='kw'>if</span> <span class='const'>EM</span><span class='period'>.</span><span class='id identifier rubyid_reactor_running?'>reactor_running?</span> <span class='kw'>then</span>
|
218
|
+
<span class='const'>EM</span><span class='op'>::</span><span class='const'>Synchrony</span><span class='period'>.</span><span class='id identifier rubyid_defer'>defer</span> <span class='kw'>do</span>
|
219
|
+
<span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_resume'>resume</span>
|
220
|
+
<span class='kw'>end</span>
|
221
|
+
<span class='kw'>else</span>
|
222
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
223
|
+
<span class='kw'>end</span>
|
224
|
+
<span class='kw'>end</span></pre>
|
225
|
+
</td>
|
226
|
+
</tr>
|
227
|
+
</table>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
121
232
|
</div>
|
122
233
|
|
123
234
|
<div id="footer">
|
124
|
-
Generated on
|
235
|
+
Generated on Wed Jan 29 14:58:29 2014 by
|
125
236
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
237
|
0.8.7.3 (ruby-2.1.0).
|
127
238
|
</div>
|
data/doc/Ballast/Concerns.html
CHANGED
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on
|
121
|
+
Generated on Wed Jan 29 14:58:29 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>
|
@@ -895,7 +895,7 @@
|
|
895
895
|
</div>
|
896
896
|
|
897
897
|
<div id="footer">
|
898
|
-
Generated on
|
898
|
+
Generated on Wed Jan 29 14:58:29 2014 by
|
899
899
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
900
900
|
0.8.7.3 (ruby-2.1.0).
|
901
901
|
</div>
|
@@ -1098,7 +1098,7 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
|
|
1098
1098
|
</div>
|
1099
1099
|
|
1100
1100
|
<div id="footer">
|
1101
|
-
Generated on
|
1101
|
+
Generated on Wed Jan 29 14:58:29 2014 by
|
1102
1102
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1103
1103
|
0.8.7.3 (ruby-2.1.0).
|
1104
1104
|
</div>
|
@@ -291,7 +291,7 @@
|
|
291
291
|
</div>
|
292
292
|
|
293
293
|
<div id="footer">
|
294
|
-
Generated on
|
294
|
+
Generated on Wed Jan 29 14:58:29 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>
|
@@ -850,7 +850,7 @@
|
|
850
850
|
</div>
|
851
851
|
|
852
852
|
<div id="footer">
|
853
|
-
Generated on
|
853
|
+
Generated on Wed Jan 29 14:58:29 2014 by
|
854
854
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
855
855
|
0.8.7.3 (ruby-2.1.0).
|
856
856
|
</div>
|
@@ -273,7 +273,7 @@ Subfolders are not supported.</p>
|
|
273
273
|
</div>
|
274
274
|
|
275
275
|
<div id="footer">
|
276
|
-
Generated on
|
276
|
+
Generated on Wed Jan 29 14:58:29 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
|
411
|
+
Generated on Wed Jan 29 14:58:29 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
|
119
|
+
Generated on Wed Jan 29 14:58:29 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
|
320
|
+
Generated on Wed Jan 29 14:58:29 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
|
151
|
+
Generated on Wed Jan 29 14:58:29 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
|
151
|
+
Generated on Wed Jan 29 14:58:29 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
|
151
|
+
Generated on Wed Jan 29 14:58:29 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
|
119
|
+
Generated on Wed Jan 29 14:58:29 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
|
348
|
+
Generated on Wed Jan 29 14:58:29 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
@@ -994,7 +994,7 @@ as owner will be created.</p>
|
|
994
994
|
<pre class="code"><span class="info file"># File 'lib/ballast/operation.rb', line 119</span>
|
995
995
|
|
996
996
|
<span class='kw'>def</span> <span class='id identifier rubyid_in_em_thread'>in_em_thread</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
997
|
-
<span class='const'>
|
997
|
+
<span class='const'>Ballast</span><span class='period'>.</span><span class='id identifier rubyid_in_em_thread'>in_em_thread</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
998
998
|
<span class='kw'>end</span></pre>
|
999
999
|
</td>
|
1000
1000
|
</tr>
|
@@ -1295,7 +1295,7 @@ as owner will be created.</p>
|
|
1295
1295
|
</div>
|
1296
1296
|
|
1297
1297
|
<div id="footer">
|
1298
|
-
Generated on
|
1298
|
+
Generated on Wed Jan 29 14:58:29 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>
|
@@ -588,7 +588,7 @@ as owner will be created.</p>
|
|
588
588
|
</div>
|
589
589
|
|
590
590
|
<div id="footer">
|
591
|
-
Generated on
|
591
|
+
Generated on Wed Jan 29 14:58:29 2014 by
|
592
592
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
593
593
|
0.8.7.3 (ruby-2.1.0).
|
594
594
|
</div>
|
@@ -908,7 +908,7 @@
|
|
908
908
|
</div>
|
909
909
|
|
910
910
|
<div id="footer">
|
911
|
-
Generated on
|
911
|
+
Generated on Wed Jan 29 14:58:29 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'>8</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
|
183
|
+
Generated on Wed Jan 29 14:58:29 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
|
313
|
+
Generated on Wed Jan 29 14:58:28 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
|
109
|
+
Generated on Wed Jan 29 14:58:28 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
|
109
|
+
Generated on Wed Jan 29 14:58:28 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,14 +150,14 @@
|
|
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.html#in_em_thread-class_method" title="Ballast.in_em_thread (method)">in_em_thread</a></span>
|
154
|
+
<small>Ballast</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/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
|
160
|
+
<small>Ballast::OperationsChain</small>
|
161
161
|
</li>
|
162
162
|
|
163
163
|
|
@@ -168,174 +168,180 @@
|
|
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/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
|
184
|
+
<small>Ballast::Configuration</small>
|
185
|
+
</li>
|
186
|
+
|
187
|
+
|
188
|
+
<li class="r2 ">
|
183
189
|
<span class='object_link'><a href="Ballast/Operation.html#initialize-instance_method" title="Ballast::Operation#initialize (method)">#initialize</a></span>
|
184
190
|
<small>Ballast::Operation</small>
|
185
191
|
</li>
|
186
192
|
|
187
193
|
|
188
|
-
<li class="
|
194
|
+
<li class="r1 ">
|
189
195
|
<span class='object_link'><a href="Ballast/Concerns/Ajax.html#is_ajax%3F-instance_method" title="Ballast::Concerns::Ajax#is_ajax? (method)">#is_ajax?</a></span>
|
190
196
|
<small>Ballast::Concerns::Ajax</small>
|
191
197
|
</li>
|
192
198
|
|
193
199
|
|
194
|
-
<li class="
|
200
|
+
<li class="r2 ">
|
195
201
|
<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
202
|
<small>Ballast::Concerns::Common</small>
|
197
203
|
</li>
|
198
204
|
|
199
205
|
|
200
|
-
<li class="
|
206
|
+
<li class="r1 ">
|
201
207
|
<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>
|
202
208
|
<small>Ballast::Concerns::View</small>
|
203
209
|
</li>
|
204
210
|
|
205
211
|
|
206
|
-
<li class="
|
212
|
+
<li class="r2 ">
|
207
213
|
<span class='object_link'><a href="Ballast/Concerns/View.html#layout_params-instance_method" title="Ballast::Concerns::View#layout_params (method)">#layout_params</a></span>
|
208
214
|
<small>Ballast::Concerns::View</small>
|
209
215
|
</li>
|
210
216
|
|
211
217
|
|
212
|
-
<li class="
|
218
|
+
<li class="r1 ">
|
213
219
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#matches%3F-instance_method" title="Ballast::RequestDomainMatcher#matches? (method)">#matches?</a></span>
|
214
220
|
<small>Ballast::RequestDomainMatcher</small>
|
215
221
|
</li>
|
216
222
|
|
217
223
|
|
218
|
-
<li class="
|
224
|
+
<li class="r2 ">
|
219
225
|
<span class='object_link'><a href="Ballast/Operation.html#method_missing-instance_method" title="Ballast::Operation#method_missing (method)">#method_missing</a></span>
|
220
226
|
<small>Ballast::Operation</small>
|
221
227
|
</li>
|
222
228
|
|
223
229
|
|
224
|
-
<li class="
|
230
|
+
<li class="r1 ">
|
225
231
|
<span class='object_link'><a href="Ballast/Context.html#method_missing-instance_method" title="Ballast::Context#method_missing (method)">#method_missing</a></span>
|
226
232
|
<small>Ballast::Context</small>
|
227
233
|
</li>
|
228
234
|
|
229
235
|
|
230
|
-
<li class="
|
236
|
+
<li class="r2 ">
|
231
237
|
<span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
|
232
238
|
<small>Ballast::OperationsChain</small>
|
233
239
|
</li>
|
234
240
|
|
235
241
|
|
236
|
-
<li class="
|
242
|
+
<li class="r1 ">
|
237
243
|
<span class='object_link'><a href="Ballast/Operation.html#perform-class_method" title="Ballast::Operation.perform (method)">perform</a></span>
|
238
244
|
<small>Ballast::Operation</small>
|
239
245
|
</li>
|
240
246
|
|
241
247
|
|
242
|
-
<li class="
|
248
|
+
<li class="r2 ">
|
243
249
|
<span class='object_link'><a href="Ballast/OperationsChain.html#perform-class_method" title="Ballast::OperationsChain.perform (method)">perform</a></span>
|
244
250
|
<small>Ballast::OperationsChain</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/Common.html#perform_operation-instance_method" title="Ballast::Concerns::Common#perform_operation (method)">#perform_operation</a></span>
|
250
256
|
<small>Ballast::Concerns::Common</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/Common.html#perform_operations_chain-instance_method" title="Ballast::Concerns::Common#perform_operations_chain (method)">#perform_operations_chain</a></span>
|
256
262
|
<small>Ballast::Concerns::Common</small>
|
257
263
|
</li>
|
258
264
|
|
259
265
|
|
260
|
-
<li class="
|
266
|
+
<li class="r1 ">
|
261
267
|
<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>
|
262
268
|
<small>Ballast::Operation</small>
|
263
269
|
</li>
|
264
270
|
|
265
271
|
|
266
|
-
<li class="
|
272
|
+
<li class="r2 ">
|
267
273
|
<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>
|
268
274
|
<small>Ballast::Concerns::Ajax</small>
|
269
275
|
</li>
|
270
276
|
|
271
277
|
|
272
|
-
<li class="
|
278
|
+
<li class="r1 ">
|
273
279
|
<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>
|
274
280
|
<small>Ballast::Concerns::Ajax</small>
|
275
281
|
</li>
|
276
282
|
|
277
283
|
|
278
|
-
<li class="
|
284
|
+
<li class="r2 ">
|
279
285
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
|
280
286
|
<small>Ballast::RequestDomainMatcher</small>
|
281
287
|
</li>
|
282
288
|
|
283
289
|
|
284
|
-
<li class="
|
290
|
+
<li class="r1 ">
|
285
291
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
|
286
292
|
<small>Ballast::RequestDomainMatcher</small>
|
287
293
|
</li>
|
288
294
|
|
289
295
|
|
290
|
-
<li class="
|
296
|
+
<li class="r2 ">
|
291
297
|
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
|
292
298
|
<small>Ballast::RequestDomainMatcher</small>
|
293
299
|
</li>
|
294
300
|
|
295
301
|
|
296
|
-
<li class="
|
302
|
+
<li class="r1 ">
|
297
303
|
<span class='object_link'><a href="Ballast/Operation.html#resolve_error-instance_method" title="Ballast::Operation#resolve_error (method)">#resolve_error</a></span>
|
298
304
|
<small>Ballast::Operation</small>
|
299
305
|
</li>
|
300
306
|
|
301
307
|
|
302
|
-
<li class="
|
308
|
+
<li class="r2 ">
|
303
309
|
<span class='object_link'><a href="Ballast/Errors/BaseError.html#response-instance_method" title="Ballast::Errors::BaseError#response (method)">#response</a></span>
|
304
310
|
<small>Ballast::Errors::BaseError</small>
|
305
311
|
</li>
|
306
312
|
|
307
313
|
|
308
|
-
<li class="
|
314
|
+
<li class="r1 ">
|
309
315
|
<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>
|
310
316
|
<small>Ballast::Concerns::View</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#send_ajax-instance_method" title="Ballast::Concerns::Ajax#send_ajax (method)">#send_ajax</a></span>
|
316
322
|
<small>Ballast::Concerns::Ajax</small>
|
317
323
|
</li>
|
318
324
|
|
319
325
|
|
320
|
-
<li class="
|
326
|
+
<li class="r1 ">
|
321
327
|
<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>
|
322
328
|
<small>Ballast::Concerns::Common</small>
|
323
329
|
</li>
|
324
330
|
|
325
331
|
|
326
|
-
<li class="
|
332
|
+
<li class="r2 ">
|
327
333
|
<span class='object_link'><a href="Ballast/Concerns/View.html#set_layout_params-instance_method" title="Ballast::Concerns::View#set_layout_params (method)">#set_layout_params</a></span>
|
328
334
|
<small>Ballast::Concerns::View</small>
|
329
335
|
</li>
|
330
336
|
|
331
337
|
|
332
|
-
<li class="
|
338
|
+
<li class="r1 ">
|
333
339
|
<span class='object_link'><a href="Ballast/Operation.html#setup_response-instance_method" title="Ballast::Operation#setup_response (method)">#setup_response</a></span>
|
334
340
|
<small>Ballast::Operation</small>
|
335
341
|
</li>
|
336
342
|
|
337
343
|
|
338
|
-
<li class="
|
344
|
+
<li class="r2 ">
|
339
345
|
<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>
|
340
346
|
<small>Ballast::Concerns::Ajax</small>
|
341
347
|
</li>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Wed Jan 29 14:58:28 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>
|
data/lib/ballast.rb
CHANGED
@@ -26,4 +26,19 @@ require "ballast/concerns/ajax"
|
|
26
26
|
require "ballast/concerns/common"
|
27
27
|
require "ballast/concerns/view"
|
28
28
|
require "ballast/concerns/errors_handling"
|
29
|
-
require "ballast/middlewares/default_host"
|
29
|
+
require "ballast/middlewares/default_host"
|
30
|
+
|
31
|
+
module Ballast
|
32
|
+
# If running under eventmachine, run the block in a thread of its threadpool using EM::Synchrony, otherwise run the block normally.
|
33
|
+
#
|
34
|
+
# @param block [Proc] The block to run.
|
35
|
+
def self.in_em_thread(&block)
|
36
|
+
if EM.reactor_running? then
|
37
|
+
EM::Synchrony.defer do
|
38
|
+
Fiber.new { block.call }.resume
|
39
|
+
end
|
40
|
+
else
|
41
|
+
block.call
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/ballast/operation.rb
CHANGED
@@ -117,7 +117,7 @@ module Ballast
|
|
117
117
|
#
|
118
118
|
# @param block [Proc] The block to run.
|
119
119
|
def in_em_thread(&block)
|
120
|
-
|
120
|
+
Ballast.in_em_thread(&block)
|
121
121
|
end
|
122
122
|
|
123
123
|
# Forwards any missing method to the owner.
|
data/lib/ballast/version.rb
CHANGED
@@ -32,7 +32,9 @@ describe Ballast::Operation do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "#in_em_thread" do
|
35
|
-
it "should
|
35
|
+
it "should call Ballast.in_em_thread" do
|
36
|
+
expect(Ballast).to receive(:in_em_thread).and_call_original
|
37
|
+
|
36
38
|
counter = 0
|
37
39
|
allow(EM).to receive(:reactor_running?).and_return(true)
|
38
40
|
expect(EM::Synchrony).to receive(:defer){|&block| block.call }
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
4
|
+
#
|
5
|
+
|
6
|
+
require "spec_helper"
|
7
|
+
|
8
|
+
describe Ballast do
|
9
|
+
describe "#in_em_thread" do
|
10
|
+
it "should yield the block in EM::Synchrony thread" do
|
11
|
+
counter = 0
|
12
|
+
allow(EM).to receive(:reactor_running?).and_return(true)
|
13
|
+
expect(EM::Synchrony).to receive(:defer){|&block| block.call }
|
14
|
+
|
15
|
+
Ballast.in_em_thread { counter = 1 }
|
16
|
+
expect(counter).to eq(1)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should call the block normally if EM::Synchrony is not running" do
|
20
|
+
counter = 0
|
21
|
+
allow(EM).to receive(:reactor_running?).and_return(false)
|
22
|
+
expect(EM::Synchrony).not_to receive(:defer)
|
23
|
+
|
24
|
+
Ballast.in_em_thread { counter = 1 }
|
25
|
+
expect(counter).to eq(1)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
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: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- spec/ballast/operation_spec.rb
|
196
196
|
- spec/ballast/operations_chain_spec.rb
|
197
197
|
- spec/ballast/request_domain_matcher_spec.rb
|
198
|
+
- spec/ballast_spec.rb
|
198
199
|
- spec/coverage_helper.rb
|
199
200
|
- spec/spec_helper.rb
|
200
201
|
homepage: http://github.com/ShogunPanda/ballast
|
@@ -233,6 +234,7 @@ test_files:
|
|
233
234
|
- spec/ballast/operation_spec.rb
|
234
235
|
- spec/ballast/operations_chain_spec.rb
|
235
236
|
- spec/ballast/request_domain_matcher_spec.rb
|
237
|
+
- spec/ballast_spec.rb
|
236
238
|
- spec/coverage_helper.rb
|
237
239
|
- spec/spec_helper.rb
|
238
240
|
has_rdoc:
|