ballast 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +21 -0
- data/README.md +40 -0
- data/Rakefile +28 -0
- data/ballast.gemspec +35 -0
- data/doc/Ballast/Concerns/Ajax.html +806 -0
- data/doc/Ballast/Concerns/Common.html +900 -0
- data/doc/Ballast/Concerns/ErrorsHandling.html +283 -0
- data/doc/Ballast/Concerns/View.html +664 -0
- data/doc/Ballast/Concerns.html +127 -0
- data/doc/Ballast/Context.html +417 -0
- data/doc/Ballast/Errors/BaseError.html +326 -0
- data/doc/Ballast/Errors/InvalidDomain.html +157 -0
- data/doc/Ballast/Errors/PerformError.html +157 -0
- data/doc/Ballast/Errors/ValidationError.html +157 -0
- data/doc/Ballast/Errors.html +125 -0
- data/doc/Ballast/Operation.html +1304 -0
- data/doc/Ballast/OperationsChain.html +585 -0
- data/doc/Ballast/Version.html +189 -0
- data/doc/Ballast.html +130 -0
- data/doc/_index.html +267 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +115 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +115 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +269 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/ballast/concerns/ajax.rb +116 -0
- data/lib/ballast/concerns/common.rb +97 -0
- data/lib/ballast/concerns/errors_handling.rb +49 -0
- data/lib/ballast/concerns/view.rb +63 -0
- data/lib/ballast/context.rb +38 -0
- data/lib/ballast/errors.rb +34 -0
- data/lib/ballast/operation.rb +136 -0
- data/lib/ballast/operations_chain.rb +38 -0
- data/lib/ballast/version.rb +24 -0
- data/lib/ballast.rb +24 -0
- data/spec/ballast/concerns/ajax_spec.rb +124 -0
- data/spec/ballast/concerns/common_spec.rb +100 -0
- data/spec/ballast/concerns/errors_handling_spec.rb +63 -0
- data/spec/ballast/concerns/view_spec.rb +107 -0
- data/spec/ballast/context_spec.rb +23 -0
- data/spec/ballast/errors_spec.rb +16 -0
- data/spec/ballast/operation_spec.rb +175 -0
- data/spec/ballast/operations_chain_spec.rb +33 -0
- data/spec/coverage_helper.rb +19 -0
- data/spec/spec_helper.rb +19 -0
- metadata +225 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Ballast::Concerns::ErrorsHandling
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (E)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Ballast.html" title="Ballast (module)">Ballast</a></span></span> » <span class='title'><span class='object_link'><a href="../Concerns.html" title="Ballast::Concerns (module)">Concerns</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">ErrorsHandling</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Ballast::Concerns::ErrorsHandling
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<dt class="r1">Extended by:</dt>
|
77
|
+
<dd class="r1">ActiveSupport::Concern</dd>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/ballast/concerns/errors_handling.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>A concern to handle errors.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#handle_error-instance_method" title="#handle_error (instance method)">- (Object) <strong>handle_error</strong>(exception = nil, layout = "error", title = "Error - Application") </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Handles an error in the application.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<div id="instance_method_details" class="method_details_list">
|
146
|
+
<h2>Instance Method Details</h2>
|
147
|
+
|
148
|
+
|
149
|
+
<div class="method_details first">
|
150
|
+
<h3 class="signature first" id="handle_error-instance_method">
|
151
|
+
|
152
|
+
- (<tt>Object</tt>) <strong>handle_error</strong>(exception = nil, layout = "error", title = "Error - Application")
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</h3><div class="docstring">
|
159
|
+
<div class="discussion">
|
160
|
+
<p>Handles an error in the application.</p>
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
<div class="tags">
|
166
|
+
<p class="tag_title">Parameters:</p>
|
167
|
+
<ul class="param">
|
168
|
+
|
169
|
+
<li>
|
170
|
+
|
171
|
+
<span class='name'>exception</span>
|
172
|
+
|
173
|
+
|
174
|
+
<span class='type'>(<tt>Hash|Exception</tt>)</span>
|
175
|
+
|
176
|
+
|
177
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
178
|
+
|
179
|
+
|
180
|
+
—
|
181
|
+
<div class='inline'><p>The exception to handle.</p>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
<li>
|
187
|
+
|
188
|
+
<span class='name'>layout</span>
|
189
|
+
|
190
|
+
|
191
|
+
<span class='type'>(<tt>String</tt>)</span>
|
192
|
+
|
193
|
+
|
194
|
+
<em class="default">(defaults to: <tt>"error"</tt>)</em>
|
195
|
+
|
196
|
+
|
197
|
+
—
|
198
|
+
<div class='inline'><p>The layout to use to render the error.</p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</li>
|
202
|
+
|
203
|
+
<li>
|
204
|
+
|
205
|
+
<span class='name'>title</span>
|
206
|
+
|
207
|
+
|
208
|
+
<span class='type'>(<tt>String</tt>)</span>
|
209
|
+
|
210
|
+
|
211
|
+
<em class="default">(defaults to: <tt>"Error - Application"</tt>)</em>
|
212
|
+
|
213
|
+
|
214
|
+
—
|
215
|
+
<div class='inline'><p>The title to set in case of custom errors.</p>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
</ul>
|
221
|
+
|
222
|
+
|
223
|
+
</div><table class="source_code">
|
224
|
+
<tr>
|
225
|
+
<td>
|
226
|
+
<pre class="lines">
|
227
|
+
|
228
|
+
|
229
|
+
17
|
230
|
+
18
|
231
|
+
19
|
232
|
+
20
|
233
|
+
21
|
234
|
+
22
|
235
|
+
23
|
236
|
+
24
|
237
|
+
25
|
238
|
+
26
|
239
|
+
27
|
240
|
+
28
|
241
|
+
29
|
242
|
+
30
|
243
|
+
31
|
244
|
+
32
|
245
|
+
33</pre>
|
246
|
+
</td>
|
247
|
+
<td>
|
248
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/errors_handling.rb', line 17</span>
|
249
|
+
|
250
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_handle_error'>handle_error</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_layout'>layout</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>error</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error - Application</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
251
|
+
<span class='ivar'>@error</span> <span class='op'>||=</span> <span class='id identifier rubyid_exception'>exception</span>
|
252
|
+
|
253
|
+
<span class='kw'>if</span> <span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Debug</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
254
|
+
<span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Debug</span><span class='tstring_end'>"</span></span>
|
255
|
+
<span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='int'>503</span>
|
256
|
+
<span class='kw'>elsif</span> <span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
257
|
+
<span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='id identifier rubyid_title'>title</span>
|
258
|
+
<span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span>
|
259
|
+
<span class='ivar'>@error_message</span> <span class='op'>=</span> <span class='ivar'>@error</span><span class='lbracket'>[</span><span class='symbol'>:error</span><span class='rbracket'>]</span>
|
260
|
+
<span class='kw'>else</span>
|
261
|
+
<span class='ivar'>@error_title</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error - </span><span class='embexpr_beg'>#{</span><span class='ivar'>@error</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
262
|
+
<span class='ivar'>@error_code</span> <span class='op'>=</span> <span class='int'>500</span>
|
263
|
+
<span class='kw'>end</span>
|
264
|
+
|
265
|
+
<span class='id identifier rubyid_send_or_render_error'>send_or_render_error</span><span class='lparen'>(</span><span class='id identifier rubyid_layout'>layout</span><span class='rparen'>)</span>
|
266
|
+
<span class='kw'>end</span></pre>
|
267
|
+
</td>
|
268
|
+
</tr>
|
269
|
+
</table>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
</div>
|
273
|
+
|
274
|
+
</div>
|
275
|
+
|
276
|
+
<div id="footer">
|
277
|
+
Generated on Wed Dec 25 11:35:22 2013 by
|
278
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
279
|
+
0.8.7.3 (ruby-2.0.0).
|
280
|
+
</div>
|
281
|
+
|
282
|
+
</body>
|
283
|
+
</html>
|