ballast 1.9.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +35 -0
- data/.travis-gemfile +4 -5
- data/.travis.yml +3 -2
- data/CHANGELOG.md +62 -6
- data/Gemfile +7 -8
- data/README.md +2 -2
- data/ballast.gemspec +9 -12
- data/doc/Ballast/AjaxResponse.html +1380 -0
- data/doc/Ballast/Concerns/AjaxHandling.html +662 -0
- data/doc/Ballast/Concerns/Common.html +81 -361
- data/doc/Ballast/Concerns/ErrorsHandling.html +18 -36
- data/doc/Ballast/Concerns/View.html +181 -157
- data/doc/Ballast/Concerns.html +6 -6
- data/doc/Ballast/Configuration.html +204 -31
- data/doc/Ballast/Emoji/Character.html +411 -0
- data/doc/Ballast/Emoji/Utils.html +794 -0
- data/doc/Ballast/Emoji.html +125 -0
- data/doc/Ballast/Errors/{BaseError.html → Base.html} +61 -34
- data/doc/Ballast/Errors/{PerformError.html → Failure.html} +21 -17
- data/doc/Ballast/Errors/InvalidDomain.html +11 -11
- data/doc/Ballast/Errors/{ValidationError.html → ValidationFailure.html} +24 -16
- data/doc/Ballast/Errors.html +5 -5
- data/doc/Ballast/Middlewares/DefaultHost.html +6 -6
- data/doc/Ballast/Middlewares.html +4 -4
- data/doc/Ballast/RequestDomainMatcher.html +28 -28
- data/doc/Ballast/Service/Response.html +1243 -0
- data/doc/Ballast/Service.html +1314 -0
- data/doc/Ballast/Version.html +7 -7
- data/doc/Ballast.html +15 -15
- data/doc/_index.html +59 -30
- data/doc/class_list.html +6 -2
- data/doc/css/style.css +1 -0
- data/doc/file.README.html +6 -6
- data/doc/file_list.html +5 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +6 -6
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +167 -79
- data/doc/top-level-namespace.html +41 -4
- data/lib/ballast/ajax_response.rb +76 -0
- data/lib/ballast/concerns/ajax_handling.rb +73 -0
- data/lib/ballast/concerns/common.rb +25 -47
- data/lib/ballast/concerns/errors_handling.rb +21 -30
- data/lib/ballast/concerns/view.rb +24 -22
- data/lib/ballast/configuration.rb +30 -10
- data/lib/ballast/emoji.rb +114 -0
- data/lib/ballast/errors.rb +16 -13
- data/lib/ballast/middlewares/default_host.rb +3 -3
- data/lib/ballast/request_domain_matcher.rb +7 -7
- data/lib/ballast/service.rb +147 -0
- data/lib/ballast/version.rb +3 -3
- data/lib/ballast.rb +22 -22
- data/spec/ballast/ajax_response_spec.rb +61 -0
- data/spec/ballast/concerns/ajax_handling_spec.rb +86 -0
- data/spec/ballast/concerns/common_spec.rb +17 -52
- data/spec/ballast/concerns/errors_handling_spec.rb +35 -29
- data/spec/ballast/concerns/view_spec.rb +21 -32
- data/spec/ballast/configuration_spec.rb +66 -16
- data/spec/ballast/emoji_spec.rb +103 -0
- data/spec/ballast/errors_spec.rb +5 -5
- data/spec/ballast/middlewares/default_host_spec.rb +3 -5
- data/spec/ballast/request_domain_matcher_spec.rb +4 -4
- data/spec/ballast/service_spec.rb +137 -0
- data/spec/spec_helper.rb +1 -13
- metadata +42 -80
- data/doc/Ballast/Concerns/Ajax.html +0 -945
- data/doc/Ballast/Context.html +0 -417
- data/doc/Ballast/Operation.html +0 -1304
- data/doc/Ballast/OperationsChain.html +0 -597
- data/lib/ballast/concerns/ajax.rb +0 -134
- data/lib/ballast/context.rb +0 -38
- data/lib/ballast/operation.rb +0 -136
- data/lib/ballast/operations_chain.rb +0 -45
- data/spec/ballast/concerns/ajax_spec.rb +0 -141
- data/spec/ballast/context_spec.rb +0 -23
- data/spec/ballast/operation_spec.rb +0 -177
- data/spec/ballast/operations_chain_spec.rb +0 -61
data/doc/method_list.html
CHANGED
@@ -20,7 +20,11 @@
|
|
20
20
|
</head>
|
21
21
|
<body>
|
22
22
|
<script type="text/javascript" charset="utf-8">
|
23
|
-
|
23
|
+
var hasFrames = false;
|
24
|
+
try {
|
25
|
+
hasFrames = window.top.frames.main ? true : false;
|
26
|
+
} catch (e) { }
|
27
|
+
if (hasFrames) {
|
24
28
|
document.getElementById('base_target').target = 'main';
|
25
29
|
document.body.className = 'frames';
|
26
30
|
}
|
@@ -48,14 +52,26 @@
|
|
48
52
|
|
49
53
|
|
50
54
|
<li class="r1 ">
|
51
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
52
|
-
<small>Ballast::Concerns::
|
55
|
+
<span class='object_link'><a href="Ballast/Concerns/AjaxHandling.html#ajax_request%3F-instance_method" title="Ballast::Concerns::AjaxHandling#ajax_request? (method)">#ajax_request?</a></span>
|
56
|
+
<small>Ballast::Concerns::AjaxHandling</small>
|
53
57
|
</li>
|
54
58
|
|
55
59
|
|
56
60
|
<li class="r2 ">
|
57
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
58
|
-
<small>Ballast::Concerns::
|
61
|
+
<span class='object_link'><a href="Ballast/Concerns/AjaxHandling.html#allow_cors-instance_method" title="Ballast::Concerns::AjaxHandling#allow_cors (method)">#allow_cors</a></span>
|
62
|
+
<small>Ballast::Concerns::AjaxHandling</small>
|
63
|
+
</li>
|
64
|
+
|
65
|
+
|
66
|
+
<li class="r1 ">
|
67
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#as_ajax_response-instance_method" title="Ballast::Service::Response#as_ajax_response (method)">#as_ajax_response</a></span>
|
68
|
+
<small>Ballast::Service::Response</small>
|
69
|
+
</li>
|
70
|
+
|
71
|
+
|
72
|
+
<li class="r2 ">
|
73
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#as_json-instance_method" title="Ballast::AjaxResponse#as_json (method)">#as_json</a></span>
|
74
|
+
<small>Ballast::AjaxResponse</small>
|
59
75
|
</li>
|
60
76
|
|
61
77
|
|
@@ -78,14 +94,50 @@
|
|
78
94
|
|
79
95
|
|
80
96
|
<li class="r2 ">
|
81
|
-
<span class='object_link'><a href="Ballast/
|
82
|
-
<small>Ballast::
|
97
|
+
<span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#call-instance_method" title="Ballast::Middlewares::DefaultHost#call (method)">#call</a></span>
|
98
|
+
<small>Ballast::Middlewares::DefaultHost</small>
|
83
99
|
</li>
|
84
100
|
|
85
101
|
|
86
102
|
<li class="r1 ">
|
87
|
-
<span class='object_link'><a href="Ballast/
|
88
|
-
<small>Ballast::
|
103
|
+
<span class='object_link'><a href="Ballast/Service.html#call-class_method" title="Ballast::Service.call (method)">call</a></span>
|
104
|
+
<small>Ballast::Service</small>
|
105
|
+
</li>
|
106
|
+
|
107
|
+
|
108
|
+
<li class="r2 ">
|
109
|
+
<span class='object_link'><a href="Ballast/Service.html#call-instance_method" title="Ballast::Service#call (method)">#call</a></span>
|
110
|
+
<small>Ballast::Service</small>
|
111
|
+
</li>
|
112
|
+
|
113
|
+
|
114
|
+
<li class="r1 ">
|
115
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#data-instance_method" title="Ballast::AjaxResponse#data (method)">#data</a></span>
|
116
|
+
<small>Ballast::AjaxResponse</small>
|
117
|
+
</li>
|
118
|
+
|
119
|
+
|
120
|
+
<li class="r2 ">
|
121
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#data-instance_method" title="Ballast::Service::Response#data (method)">#data</a></span>
|
122
|
+
<small>Ballast::Service::Response</small>
|
123
|
+
</li>
|
124
|
+
|
125
|
+
|
126
|
+
<li class="r1 ">
|
127
|
+
<span class='object_link'><a href="Ballast/Configuration.html#default_environment-class_method" title="Ballast::Configuration.default_environment (method)">default_environment</a></span>
|
128
|
+
<small>Ballast::Configuration</small>
|
129
|
+
</li>
|
130
|
+
|
131
|
+
|
132
|
+
<li class="r2 ">
|
133
|
+
<span class='object_link'><a href="Ballast/Configuration.html#default_root-class_method" title="Ballast::Configuration.default_root (method)">default_root</a></span>
|
134
|
+
<small>Ballast::Configuration</small>
|
135
|
+
</li>
|
136
|
+
|
137
|
+
|
138
|
+
<li class="r1 ">
|
139
|
+
<span class='object_link'><a href="Ballast/Errors/Base.html#details-instance_method" title="Ballast::Errors::Base#details (method)">#details</a></span>
|
140
|
+
<small>Ballast::Errors::Base</small>
|
89
141
|
</li>
|
90
142
|
|
91
143
|
|
@@ -96,8 +148,44 @@
|
|
96
148
|
|
97
149
|
|
98
150
|
<li class="r1 ">
|
99
|
-
<span class='object_link'><a href="Ballast/
|
100
|
-
<small>Ballast::
|
151
|
+
<span class='object_link'><a href="Ballast/Emoji/Utils.html#enumerate-instance_method" title="Ballast::Emoji::Utils#enumerate (method)">#enumerate</a></span>
|
152
|
+
<small>Ballast::Emoji::Utils</small>
|
153
|
+
</li>
|
154
|
+
|
155
|
+
|
156
|
+
<li class="r2 ">
|
157
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#error-instance_method" title="Ballast::AjaxResponse#error (method)">#error</a></span>
|
158
|
+
<small>Ballast::AjaxResponse</small>
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="r1 ">
|
163
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#error-instance_method" title="Ballast::Service::Response#error (method)">#error</a></span>
|
164
|
+
<small>Ballast::Service::Response</small>
|
165
|
+
</li>
|
166
|
+
|
167
|
+
|
168
|
+
<li class="r2 ">
|
169
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#errors-instance_method" title="Ballast::Service::Response#errors (method)">#errors</a></span>
|
170
|
+
<small>Ballast::Service::Response</small>
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
<li class="r1 ">
|
175
|
+
<span class='object_link'><a href="Ballast/Service.html#fail%21-instance_method" title="Ballast::Service#fail! (method)">#fail!</a></span>
|
176
|
+
<small>Ballast::Service</small>
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
<li class="r2 ">
|
181
|
+
<span class='object_link'><a href="Ballast/Service.html#fail%21-class_method" title="Ballast::Service.fail! (method)">fail!</a></span>
|
182
|
+
<small>Ballast::Service</small>
|
183
|
+
</li>
|
184
|
+
|
185
|
+
|
186
|
+
<li class="r1 ">
|
187
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#fail%3F-instance_method" title="Ballast::Service::Response#fail? (method)">#fail?</a></span>
|
188
|
+
<small>Ballast::Service::Response</small>
|
101
189
|
</li>
|
102
190
|
|
103
191
|
|
@@ -120,8 +208,8 @@
|
|
120
208
|
|
121
209
|
|
122
210
|
<li class="r1 ">
|
123
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
124
|
-
<small>Ballast::Concerns::
|
211
|
+
<span class='object_link'><a href="Ballast/Concerns/AjaxHandling.html#generate_robots_txt-instance_method" title="Ballast::Concerns::AjaxHandling#generate_robots_txt (method)">#generate_robots_txt</a></span>
|
212
|
+
<small>Ballast::Concerns::AjaxHandling</small>
|
125
213
|
</li>
|
126
214
|
|
127
215
|
|
@@ -132,32 +220,32 @@
|
|
132
220
|
|
133
221
|
|
134
222
|
<li class="r1 ">
|
135
|
-
<span class='object_link'><a href="Ballast/
|
136
|
-
<small>Ballast::
|
223
|
+
<span class='object_link'><a href="Ballast/Service.html#handle_failure-class_method" title="Ballast::Service.handle_failure (method)">handle_failure</a></span>
|
224
|
+
<small>Ballast::Service</small>
|
137
225
|
</li>
|
138
226
|
|
139
227
|
|
140
228
|
<li class="r2 ">
|
141
|
-
<span class='object_link'><a href="Ballast/
|
142
|
-
<small>Ballast::
|
229
|
+
<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>
|
230
|
+
<small>Ballast::Emoji::Character</small>
|
143
231
|
</li>
|
144
232
|
|
145
233
|
|
146
234
|
<li class="r1 ">
|
147
|
-
<span class='object_link'><a href="Ballast
|
148
|
-
<small>Ballast
|
235
|
+
<span class='object_link'><a href="Ballast.html#in_em_thread-class_method" title="Ballast.in_em_thread (method)">in_em_thread</a></span>
|
236
|
+
<small>Ballast</small>
|
149
237
|
</li>
|
150
238
|
|
151
239
|
|
152
240
|
<li class="r2 ">
|
153
|
-
<span class='object_link'><a href="Ballast.html#
|
154
|
-
<small>Ballast</small>
|
241
|
+
<span class='object_link'><a href="Ballast/Service.html#initialize-instance_method" title="Ballast::Service#initialize (method)">#initialize</a></span>
|
242
|
+
<small>Ballast::Service</small>
|
155
243
|
</li>
|
156
244
|
|
157
245
|
|
158
246
|
<li class="r1 ">
|
159
|
-
<span class='object_link'><a href="Ballast/
|
160
|
-
<small>Ballast::
|
247
|
+
<span class='object_link'><a href="Ballast/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
|
248
|
+
<small>Ballast::Configuration</small>
|
161
249
|
</li>
|
162
250
|
|
163
251
|
|
@@ -168,50 +256,50 @@
|
|
168
256
|
|
169
257
|
|
170
258
|
<li class="r1 ">
|
171
|
-
<span class='object_link'><a href="Ballast/
|
172
|
-
<small>Ballast::
|
259
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#initialize-instance_method" title="Ballast::AjaxResponse#initialize (method)">#initialize</a></span>
|
260
|
+
<small>Ballast::AjaxResponse</small>
|
173
261
|
</li>
|
174
262
|
|
175
263
|
|
176
264
|
<li class="r2 ">
|
177
|
-
<span class='object_link'><a href="Ballast/
|
178
|
-
<small>Ballast::
|
265
|
+
<span class='object_link'><a href="Ballast/Errors/Base.html#initialize-instance_method" title="Ballast::Errors::Base#initialize (method)">#initialize</a></span>
|
266
|
+
<small>Ballast::Errors::Base</small>
|
179
267
|
</li>
|
180
268
|
|
181
269
|
|
182
270
|
<li class="r1 ">
|
183
|
-
<span class='object_link'><a href="Ballast/
|
184
|
-
<small>Ballast::
|
271
|
+
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
|
272
|
+
<small>Ballast::RequestDomainMatcher</small>
|
185
273
|
</li>
|
186
274
|
|
187
275
|
|
188
276
|
<li class="r2 ">
|
189
|
-
<span class='object_link'><a href="Ballast/
|
190
|
-
<small>Ballast::
|
277
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#initialize-instance_method" title="Ballast::Service::Response#initialize (method)">#initialize</a></span>
|
278
|
+
<small>Ballast::Service::Response</small>
|
191
279
|
</li>
|
192
280
|
|
193
281
|
|
194
282
|
<li class="r1 ">
|
195
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
196
|
-
<small>Ballast::Concerns::
|
283
|
+
<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>
|
284
|
+
<small>Ballast::Concerns::View</small>
|
197
285
|
</li>
|
198
286
|
|
199
287
|
|
200
288
|
<li class="r2 ">
|
201
|
-
<span class='object_link'><a href="Ballast/Concerns/Common.html#
|
289
|
+
<span class='object_link'><a href="Ballast/Concerns/Common.html#json%3F-instance_method" title="Ballast::Concerns::Common#json? (method)">#json?</a></span>
|
202
290
|
<small>Ballast::Concerns::Common</small>
|
203
291
|
</li>
|
204
292
|
|
205
293
|
|
206
294
|
<li class="r1 ">
|
207
|
-
<span class='object_link'><a href="Ballast/Concerns/View.html#
|
295
|
+
<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
296
|
<small>Ballast::Concerns::View</small>
|
209
297
|
</li>
|
210
298
|
|
211
299
|
|
212
300
|
<li class="r2 ">
|
213
|
-
<span class='object_link'><a href="Ballast/
|
214
|
-
<small>Ballast::
|
301
|
+
<span class='object_link'><a href="Ballast/Emoji/Character.html#markup-instance_method" title="Ballast::Emoji::Character#markup (method)">#markup</a></span>
|
302
|
+
<small>Ballast::Emoji::Character</small>
|
215
303
|
</li>
|
216
304
|
|
217
305
|
|
@@ -222,128 +310,128 @@
|
|
222
310
|
|
223
311
|
|
224
312
|
<li class="r2 ">
|
225
|
-
<span class='object_link'><a href="Ballast/
|
226
|
-
<small>Ballast::
|
313
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#numeric_status-instance_method" title="Ballast::AjaxResponse#numeric_status (method)">#numeric_status</a></span>
|
314
|
+
<small>Ballast::AjaxResponse</small>
|
227
315
|
</li>
|
228
316
|
|
229
317
|
|
230
318
|
<li class="r1 ">
|
231
|
-
<span class='object_link'><a href="Ballast/
|
232
|
-
<small>Ballast::
|
319
|
+
<span class='object_link'><a href="Ballast/Service.html#owner-instance_method" title="Ballast::Service#owner (method)">#owner</a></span>
|
320
|
+
<small>Ballast::Service</small>
|
233
321
|
</li>
|
234
322
|
|
235
323
|
|
236
324
|
<li class="r2 ">
|
237
|
-
<span class='object_link'><a href="Ballast/
|
238
|
-
<small>Ballast::
|
325
|
+
<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
|
+
<small>Ballast::Concerns::AjaxHandling</small>
|
239
327
|
</li>
|
240
328
|
|
241
329
|
|
242
330
|
<li class="r1 ">
|
243
|
-
<span class='object_link'><a href="Ballast/
|
244
|
-
<small>Ballast::
|
331
|
+
<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
|
+
<small>Ballast::Concerns::AjaxHandling</small>
|
245
333
|
</li>
|
246
334
|
|
247
335
|
|
248
336
|
<li class="r2 ">
|
249
|
-
<span class='object_link'><a href="Ballast/
|
250
|
-
<small>Ballast::
|
337
|
+
<span class='object_link'><a href="Ballast/Emoji/Utils.html#replace-instance_method" title="Ballast::Emoji::Utils#replace (method)">#replace</a></span>
|
338
|
+
<small>Ballast::Emoji::Utils</small>
|
251
339
|
</li>
|
252
340
|
|
253
341
|
|
254
342
|
<li class="r1 ">
|
255
|
-
<span class='object_link'><a href="Ballast/
|
256
|
-
<small>Ballast::
|
343
|
+
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
|
344
|
+
<small>Ballast::RequestDomainMatcher</small>
|
257
345
|
</li>
|
258
346
|
|
259
347
|
|
260
348
|
<li class="r2 ">
|
261
|
-
<span class='object_link'><a href="Ballast/
|
262
|
-
<small>Ballast::
|
349
|
+
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
|
350
|
+
<small>Ballast::RequestDomainMatcher</small>
|
263
351
|
</li>
|
264
352
|
|
265
353
|
|
266
354
|
<li class="r1 ">
|
267
|
-
<span class='object_link'><a href="Ballast/
|
268
|
-
<small>Ballast::
|
355
|
+
<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
|
+
<small>Ballast::Emoji::Utils</small>
|
269
357
|
</li>
|
270
358
|
|
271
359
|
|
272
360
|
<li class="r2 ">
|
273
|
-
<span class='object_link'><a href="Ballast/
|
274
|
-
<small>Ballast::
|
361
|
+
<span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
|
362
|
+
<small>Ballast::RequestDomainMatcher</small>
|
275
363
|
</li>
|
276
364
|
|
277
365
|
|
278
366
|
<li class="r1 ">
|
279
|
-
<span class='object_link'><a href="Ballast/
|
280
|
-
<small>Ballast::
|
367
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#reply-instance_method" title="Ballast::AjaxResponse#reply (method)">#reply</a></span>
|
368
|
+
<small>Ballast::AjaxResponse</small>
|
281
369
|
</li>
|
282
370
|
|
283
371
|
|
284
372
|
<li class="r2 ">
|
285
|
-
<span class='object_link'><a href="Ballast/
|
286
|
-
<small>Ballast::
|
373
|
+
<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
|
+
<small>Ballast::Concerns::Common</small>
|
287
375
|
</li>
|
288
376
|
|
289
377
|
|
290
378
|
<li class="r1 ">
|
291
|
-
<span class='object_link'><a href="Ballast/
|
292
|
-
<small>Ballast::
|
379
|
+
<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
|
+
<small>Ballast::Concerns::View</small>
|
293
381
|
</li>
|
294
382
|
|
295
383
|
|
296
384
|
<li class="r2 ">
|
297
|
-
<span class='object_link'><a href="Ballast/
|
298
|
-
<small>Ballast::
|
385
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#status-instance_method" title="Ballast::AjaxResponse#status (method)">#status</a></span>
|
386
|
+
<small>Ballast::AjaxResponse</small>
|
299
387
|
</li>
|
300
388
|
|
301
389
|
|
302
390
|
<li class="r1 ">
|
303
|
-
<span class='object_link'><a href="Ballast/
|
304
|
-
<small>Ballast::
|
391
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#success-instance_method" title="Ballast::Service::Response#success (method)">#success</a></span>
|
392
|
+
<small>Ballast::Service::Response</small>
|
305
393
|
</li>
|
306
394
|
|
307
395
|
|
308
396
|
<li class="r2 ">
|
309
|
-
<span class='object_link'><a href="Ballast/
|
310
|
-
<small>Ballast::
|
397
|
+
<span class='object_link'><a href="Ballast/Service/Response.html#success%3F-instance_method" title="Ballast::Service::Response#success? (method)">#success?</a></span>
|
398
|
+
<small>Ballast::Service::Response</small>
|
311
399
|
</li>
|
312
400
|
|
313
401
|
|
314
402
|
<li class="r1 ">
|
315
|
-
<span class='object_link'><a href="Ballast/
|
316
|
-
<small>Ballast::
|
403
|
+
<span class='object_link'><a href="Ballast/AjaxResponse.html#transport-instance_method" title="Ballast::AjaxResponse#transport (method)">#transport</a></span>
|
404
|
+
<small>Ballast::AjaxResponse</small>
|
317
405
|
</li>
|
318
406
|
|
319
407
|
|
320
408
|
<li class="r2 ">
|
321
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
322
|
-
<small>Ballast::Concerns::
|
409
|
+
<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
|
+
<small>Ballast::Concerns::View</small>
|
323
411
|
</li>
|
324
412
|
|
325
413
|
|
326
414
|
<li class="r1 ">
|
327
|
-
<span class='object_link'><a href="Ballast/Concerns/
|
328
|
-
<small>Ballast::Concerns::
|
415
|
+
<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
|
+
<small>Ballast::Concerns::View</small>
|
329
417
|
</li>
|
330
418
|
|
331
419
|
|
332
420
|
<li class="r2 ">
|
333
|
-
<span class='object_link'><a href="Ballast/
|
334
|
-
<small>Ballast::
|
421
|
+
<span class='object_link'><a href="Ballast/Emoji/Character.html#url-instance_method" title="Ballast::Emoji::Character#url (method)">#url</a></span>
|
422
|
+
<small>Ballast::Emoji::Character</small>
|
335
423
|
</li>
|
336
424
|
|
337
425
|
|
338
426
|
<li class="r1 ">
|
339
|
-
<span class='object_link'><a href="Ballast/
|
340
|
-
<small>Ballast::
|
427
|
+
<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
|
+
<small>Ballast::Emoji::Utils</small>
|
341
429
|
</li>
|
342
430
|
|
343
431
|
|
344
432
|
<li class="r2 ">
|
345
|
-
<span class='object_link'><a href="Ballast/
|
346
|
-
<small>Ballast::
|
433
|
+
<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
|
+
<small>Ballast::Emoji::Utils</small>
|
347
435
|
</li>
|
348
436
|
|
349
437
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!"
|
20
|
+
framesUrl = "frames.html#!top-level-namespace.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -73,8 +73,16 @@
|
|
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
|
+
|
76
80
|
|
77
81
|
|
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
|
+
|
78
86
|
|
79
87
|
|
80
88
|
|
@@ -97,15 +105,44 @@
|
|
97
105
|
|
98
106
|
|
99
107
|
|
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
|
+
|
100
114
|
|
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>
|
101
125
|
|
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
|
+
|
102
139
|
|
103
140
|
</div>
|
104
141
|
|
105
142
|
<div id="footer">
|
106
|
-
Generated on
|
143
|
+
Generated on Sun Nov 2 09:40:00 2014 by
|
107
144
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
-
0.8.7.
|
145
|
+
0.8.7.6 (ruby-2.1.3).
|
109
146
|
</div>
|
110
147
|
|
111
148
|
</body>
|
@@ -0,0 +1,76 @@
|
|
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
|
+
module Ballast
|
7
|
+
# An AJAX response.
|
8
|
+
#
|
9
|
+
# @attribute status
|
10
|
+
# @return [Symbol|Fixnum] The HTTP status of the response.
|
11
|
+
# @attribute data
|
12
|
+
# @return [Object|Hash|NilClass] The data to send to the client.
|
13
|
+
# @attribute error
|
14
|
+
# @return [Object|NilClass] A error message.
|
15
|
+
# @attribute transport
|
16
|
+
# @return [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.
|
17
|
+
class AjaxResponse
|
18
|
+
attr_accessor :status, :data, :error, :transport
|
19
|
+
|
20
|
+
# Creates an AJAX response.
|
21
|
+
#
|
22
|
+
# @param status [Symbol|Fixnum] The HTTP status of the response.
|
23
|
+
# @param data [Object|Hash|NilClass] Additional data to append to the response.
|
24
|
+
# @param error [Object|NilClass] A error to append to the response.
|
25
|
+
# @param transport [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.
|
26
|
+
def initialize(status: :ok, data: {}, error: nil, transport: nil)
|
27
|
+
@status = status
|
28
|
+
@data = data
|
29
|
+
@error = error
|
30
|
+
@transport = transport
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the status as a number.
|
34
|
+
#
|
35
|
+
# @return [Fixnum] The status as a number.
|
36
|
+
def numeric_status
|
37
|
+
status.is_a?(Fixnum) ? status : Rack::Utils.status_code(status.ensure_string.to_sym)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns a JSON representation of the response.
|
41
|
+
#
|
42
|
+
# @param options [Hash] The options to use for serializing. Currently only `original_status` is supported.
|
43
|
+
# @return [Hash] A JSON representation of the response.
|
44
|
+
def as_json(options = {})
|
45
|
+
{
|
46
|
+
status: options[:original_status] ? status : numeric_status,
|
47
|
+
data: data,
|
48
|
+
error: error
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Sends the response using the transport.
|
53
|
+
#
|
54
|
+
# @param format [Symbol] The content type of the response.
|
55
|
+
# @param pretty_json [Boolean] If JSON response must be pretty formatted.
|
56
|
+
def reply(format: :json, pretty_json: false)
|
57
|
+
return if transport.performed?
|
58
|
+
|
59
|
+
format, callback, content_type = format_reply(format)
|
60
|
+
data = (pretty_json ? Oj.dump(self) : ActiveSupport::JSON.encode(self)) if [:json, :jsonp, :text].include?(format)
|
61
|
+
|
62
|
+
transport.render(format => data, status: numeric_status, callback: callback, content_type: content_type)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# :nodoc:
|
68
|
+
def format_reply(format)
|
69
|
+
format = (format || transport.params[:format] || transport.request.format || "json").to_sym
|
70
|
+
callback = [:jsonp, :pretty_jsonp].include?(format) ? (transport.params[:callback] || "jsonp#{Time.now.to_i}") : nil
|
71
|
+
content_type = (format == :text) ? "text/plain" : nil
|
72
|
+
|
73
|
+
[format, callback, content_type]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|