mbrao 1.4.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +29 -0
  3. data/.travis.yml +3 -4
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +4 -4
  6. data/doc/ActionView.html +125 -0
  7. data/doc/ActionView/Template.html +140 -0
  8. data/doc/ActionView/Template/Handlers.html +3 -3
  9. data/doc/ActionView/Template/Handlers/MbraoTemplate.html +26 -26
  10. data/doc/HTML.html +2 -2
  11. data/doc/HTML/Pipeline.html +2 -2
  12. data/doc/HTML/Pipeline/KramdownFilter.html +4 -4
  13. data/doc/Mbrao.html +3 -3
  14. data/doc/Mbrao/Author.html +29 -29
  15. data/doc/Mbrao/Content.html +1977 -3644
  16. data/doc/Mbrao/ContentInterface.html +817 -0
  17. data/doc/Mbrao/ContentInterface/ClassMethods.html +388 -0
  18. data/doc/Mbrao/Exceptions.html +1 -1
  19. data/doc/Mbrao/Exceptions/InvalidDate.html +1 -1
  20. data/doc/Mbrao/Exceptions/InvalidMetadata.html +1 -1
  21. data/doc/Mbrao/Exceptions/Parsing.html +1 -1
  22. data/doc/Mbrao/Exceptions/Rendering.html +1 -1
  23. data/doc/Mbrao/Exceptions/UnavailableLocalization.html +1 -1
  24. data/doc/Mbrao/Exceptions/Unimplemented.html +1 -1
  25. data/doc/Mbrao/Exceptions/UnknownEngine.html +1 -1
  26. data/doc/Mbrao/Parser.html +12 -12
  27. data/doc/Mbrao/ParserInterface.html +134 -0
  28. data/doc/Mbrao/ParserInterface/ClassMethods.html +1724 -0
  29. data/doc/Mbrao/ParserValidations.html +134 -0
  30. data/doc/Mbrao/ParserValidations/ClassMethods.html +348 -0
  31. data/doc/Mbrao/ParsingEngines.html +1 -1
  32. data/doc/Mbrao/ParsingEngines/Base.html +4 -4
  33. data/doc/Mbrao/ParsingEngines/PlainText.html +25 -15
  34. data/doc/Mbrao/RenderingEngines.html +1 -1
  35. data/doc/Mbrao/RenderingEngines/Base.html +2 -2
  36. data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +173 -169
  37. data/doc/Mbrao/Version.html +3 -3
  38. data/doc/_index.html +51 -24
  39. data/doc/class_list.html +1 -1
  40. data/doc/file.README.html +1 -1
  41. data/doc/index.html +1 -1
  42. data/doc/method_list.html +63 -69
  43. data/doc/top-level-namespace.html +2 -2
  44. data/lib/mbrao.rb +7 -2
  45. data/lib/mbrao/author.rb +5 -5
  46. data/lib/mbrao/content.rb +110 -256
  47. data/lib/mbrao/content_interface.rb +146 -0
  48. data/lib/mbrao/exceptions.rb +1 -1
  49. data/lib/mbrao/integrations/rails.rb +48 -42
  50. data/lib/mbrao/parser.rb +24 -176
  51. data/lib/mbrao/parser_interface.rb +143 -0
  52. data/lib/mbrao/parser_validations.rb +41 -0
  53. data/lib/mbrao/parsing_engines/base.rb +4 -4
  54. data/lib/mbrao/parsing_engines/plain_text.rb +136 -121
  55. data/lib/mbrao/rendering_engines/base.rb +2 -2
  56. data/lib/mbrao/rendering_engines/html_pipeline.rb +52 -77
  57. data/lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb +31 -0
  58. data/lib/mbrao/version.rb +2 -2
  59. data/mbrao.gemspec +3 -3
  60. data/spec/mbrao/author_spec.rb +1 -1
  61. data/spec/mbrao/content_spec.rb +1 -1
  62. data/spec/mbrao/parser_spec.rb +16 -16
  63. data/spec/mbrao/rendering_engines/html_pipeline/kramdown_filter_spec.rb +28 -0
  64. data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +0 -21
  65. metadata +23 -8
@@ -0,0 +1,388 @@
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: Mbrao::ContentInterface::ClassMethods
8
+
9
+ &mdash; Documentation by YARD 0.8.7.4
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#!Mbrao/ContentInterface/ClassMethods.html";
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 (C)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Mbrao.html" title="Mbrao (module)">Mbrao</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ContentInterface.html" title="Mbrao::ContentInterface (module)">ContentInterface</a></span></span>
36
+ &raquo;
37
+ <span class="title">ClassMethods</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: Mbrao::ContentInterface::ClassMethods
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/mbrao/content_interface.rb</dd>
83
+
84
+ </dl>
85
+ <div class="clear"></div>
86
+
87
+ <h2>Overview</h2><div class="docstring">
88
+ <div class="discussion">
89
+ <p>Class methods.</p>
90
+
91
+
92
+ </div>
93
+ </div>
94
+ <div class="tags">
95
+
96
+
97
+ </div>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <h2>
106
+ Instance Method Summary
107
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
108
+ </h2>
109
+
110
+ <ul class="summary">
111
+
112
+ <li class="public ">
113
+ <span class="summary_signature">
114
+
115
+ <a href="#create-instance_method" title="#create (instance method)">- (Content) <strong>create</strong>(metadata, body) </a>
116
+
117
+
118
+
119
+ </span>
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ <span class="summary_desc"><div class='inline'><p>Creates a content with metadata and body.</p>
130
+ </div></span>
131
+
132
+ </li>
133
+
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#validate_locales-instance_method" title="#validate_locales (instance method)">- (Array) <strong>validate_locales</strong>(locales, content = nil) </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'><p>Validates locales for attribute retrieval.</p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ </ul>
159
+
160
+
161
+
162
+
163
+ <div id="instance_method_details" class="method_details_list">
164
+ <h2>Instance Method Details</h2>
165
+
166
+
167
+ <div class="method_details first">
168
+ <h3 class="signature first" id="create-instance_method">
169
+
170
+ - (<tt><span class='object_link'><a href="../Content.html" title="Mbrao::Content (class)">Content</a></span></tt>) <strong>create</strong>(metadata, body)
171
+
172
+
173
+
174
+
175
+
176
+ </h3><div class="docstring">
177
+ <div class="discussion">
178
+ <p>Creates a content with metadata and body.</p>
179
+
180
+
181
+ </div>
182
+ </div>
183
+ <div class="tags">
184
+ <p class="tag_title">Parameters:</p>
185
+ <ul class="param">
186
+
187
+ <li>
188
+
189
+ <span class='name'>metadata</span>
190
+
191
+
192
+ <span class='type'>(<tt>Hash</tt>)</span>
193
+
194
+
195
+
196
+ &mdash;
197
+ <div class='inline'><p>The metadata.</p>
198
+ </div>
199
+
200
+ </li>
201
+
202
+ <li>
203
+
204
+ <span class='name'>body</span>
205
+
206
+
207
+ <span class='type'>(<tt>String</tt>)</span>
208
+
209
+
210
+
211
+ &mdash;
212
+ <div class='inline'><p>The body of the content.</p>
213
+ </div>
214
+
215
+ </li>
216
+
217
+ </ul>
218
+
219
+ <p class="tag_title">Returns:</p>
220
+ <ul class="return">
221
+
222
+ <li>
223
+
224
+
225
+ <span class='type'>(<tt><span class='object_link'><a href="../Content.html" title="Mbrao::Content (class)">Content</a></span></tt>)</span>
226
+
227
+
228
+
229
+ &mdash;
230
+ <div class='inline'><p>A new content.</p>
231
+ </div>
232
+
233
+ </li>
234
+
235
+ </ul>
236
+
237
+ </div><table class="source_code">
238
+ <tr>
239
+ <td>
240
+ <pre class="lines">
241
+
242
+
243
+ 44
244
+ 45
245
+ 46
246
+ 47
247
+ 48
248
+ 49</pre>
249
+ </td>
250
+ <td>
251
+ <pre class="code"><span class="info file"># File 'lib/mbrao/content_interface.rb', line 44</span>
252
+
253
+ <span class='kw'>def</span> <span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
254
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Content</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
255
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
256
+ <span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</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>
257
+ <span class='id identifier rubyid_rv'>rv</span>
258
+ <span class='kw'>end</span></pre>
259
+ </td>
260
+ </tr>
261
+ </table>
262
+ </div>
263
+
264
+ <div class="method_details ">
265
+ <h3 class="signature " id="validate_locales-instance_method">
266
+
267
+ - (<tt>Array</tt>) <strong>validate_locales</strong>(locales, content = nil)
268
+
269
+
270
+
271
+
272
+
273
+ </h3><div class="docstring">
274
+ <div class="discussion">
275
+ <p>Validates locales for attribute retrieval.</p>
276
+
277
+
278
+ </div>
279
+ </div>
280
+ <div class="tags">
281
+ <p class="tag_title">Parameters:</p>
282
+ <ul class="param">
283
+
284
+ <li>
285
+
286
+ <span class='name'>locales</span>
287
+
288
+
289
+ <span class='type'>(<tt>Array</tt>)</span>
290
+
291
+
292
+
293
+ &mdash;
294
+ <div class='inline'><p>A list of desired locales for an attribute. Can include <code>*</code> to match all. If none are specified, the default mbrao locale will be
295
+ used.</p>
296
+ </div>
297
+
298
+ </li>
299
+
300
+ <li>
301
+
302
+ <span class='name'>content</span>
303
+
304
+
305
+ <span class='type'>(<tt><span class='object_link'><a href="../Content.html" title="Mbrao::Content (class)">Content</a></span>|nil</tt>)</span>
306
+
307
+
308
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
309
+
310
+
311
+ &mdash;
312
+ <div class='inline'><p>An optional content to check for availability</p>
313
+ </div>
314
+
315
+ </li>
316
+
317
+ </ul>
318
+
319
+ <p class="tag_title">Returns:</p>
320
+ <ul class="return">
321
+
322
+ <li>
323
+
324
+
325
+ <span class='type'>(<tt>Array</tt>)</span>
326
+
327
+
328
+
329
+ &mdash;
330
+ <div class='inline'><p>The validated list of locales.</p>
331
+ </div>
332
+
333
+ </li>
334
+
335
+ </ul>
336
+ <p class="tag_title">Raises:</p>
337
+ <ul class="raise">
338
+
339
+ <li>
340
+
341
+
342
+ <span class='type'>(<tt><span class='object_link'><a href="../Exceptions/UnavailableLocalization.html" title="Mbrao::Exceptions::UnavailableLocalization (class)">Mbrao::Exceptions::UnavailableLocalization</a></span></tt>)</span>
343
+
344
+
345
+
346
+ </li>
347
+
348
+ </ul>
349
+
350
+ </div><table class="source_code">
351
+ <tr>
352
+ <td>
353
+ <pre class="lines">
354
+
355
+
356
+ 32
357
+ 33
358
+ 34
359
+ 35
360
+ 36
361
+ 37</pre>
362
+ </td>
363
+ <td>
364
+ <pre class="code"><span class="info file"># File 'lib/mbrao/content_interface.rb', line 32</span>
365
+
366
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
367
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='rbrace'>}</span>
368
+ <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_locale'>locale</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
369
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnavailableLocalization</span> <span class='kw'>if</span> <span class='id identifier rubyid_content'>content</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_enabled_for_locales?'>enabled_for_locales?</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
370
+ <span class='id identifier rubyid_locales'>locales</span>
371
+ <span class='kw'>end</span></pre>
372
+ </td>
373
+ </tr>
374
+ </table>
375
+ </div>
376
+
377
+ </div>
378
+
379
+ </div>
380
+
381
+ <div id="footer">
382
+ Generated on Sun May 11 18:17:17 2014 by
383
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
384
+ 0.8.7.4 (ruby-2.1.0).
385
+ </div>
386
+
387
+ </body>
388
+ </html>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Apr 9 21:36:00 2014 by
119
+ Generated on Sun May 11 18:17:17 2014 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.7.4 (ruby-2.1.0).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:00 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:00 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:00 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:00 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:01 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 9 21:36:01 2014 by
127
+ Generated on Sun May 11 18:17:19 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.7.4 (ruby-2.1.0).
130
130
  </div>