mbrao 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/CHANGELOG.md +5 -0
  4. data/doc/ActionView/Template/Handlers/MbraoTemplate.html +87 -20
  5. data/doc/ActionView/Template/Handlers.html +1 -1
  6. data/doc/HTML/Pipeline/KramdownFilter.html +1 -1
  7. data/doc/HTML/Pipeline.html +1 -1
  8. data/doc/HTML.html +1 -1
  9. data/doc/Mbrao/Author.html +337 -67
  10. data/doc/Mbrao/Content.html +1268 -444
  11. data/doc/Mbrao/ContentPublicInterface.html +24 -20
  12. data/doc/Mbrao/Exceptions/InvalidDate.html +1 -1
  13. data/doc/Mbrao/Exceptions/InvalidMetadata.html +1 -1
  14. data/doc/Mbrao/Exceptions/Parsing.html +1 -1
  15. data/doc/Mbrao/Exceptions/Rendering.html +1 -1
  16. data/doc/Mbrao/Exceptions/UnavailableLocalization.html +1 -1
  17. data/doc/Mbrao/Exceptions/Unimplemented.html +1 -1
  18. data/doc/Mbrao/Exceptions/UnknownEngine.html +1 -1
  19. data/doc/Mbrao/Exceptions.html +1 -1
  20. data/doc/Mbrao/Parser.html +11 -11
  21. data/doc/Mbrao/ParsingEngines/Base.html +25 -24
  22. data/doc/Mbrao/ParsingEngines/PlainText.html +17 -16
  23. data/doc/Mbrao/ParsingEngines.html +1 -1
  24. data/doc/Mbrao/PublicInterface/ClassMethods.html +312 -19
  25. data/doc/Mbrao/PublicInterface.html +1 -1
  26. data/doc/Mbrao/RenderingEngines/Base.html +7 -7
  27. data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +27 -15
  28. data/doc/Mbrao/RenderingEngines.html +1 -1
  29. data/doc/Mbrao/Validations/ClassMethods.html +21 -21
  30. data/doc/Mbrao/Validations.html +1 -1
  31. data/doc/Mbrao/Version.html +3 -3
  32. data/doc/Mbrao.html +1 -1
  33. data/doc/_index.html +1 -1
  34. data/doc/file.README.html +1 -1
  35. data/doc/index.html +1 -1
  36. data/doc/method_list.html +86 -62
  37. data/doc/top-level-namespace.html +1 -1
  38. data/lib/mbrao/author.rb +18 -4
  39. data/lib/mbrao/content.rb +93 -44
  40. data/lib/mbrao/integrations/rails.rb +12 -5
  41. data/lib/mbrao/parser.rb +23 -0
  42. data/lib/mbrao/parsing_engines/base.rb +12 -11
  43. data/lib/mbrao/parsing_engines/plain_text.rb +29 -23
  44. data/lib/mbrao/rendering_engines/base.rb +4 -4
  45. data/lib/mbrao/rendering_engines/html_pipeline.rb +7 -2
  46. data/lib/mbrao/version.rb +2 -2
  47. data/spec/mbrao/author_spec.rb +32 -16
  48. data/spec/mbrao/content_spec.rb +144 -85
  49. data/spec/mbrao/integrations/rails_spec.rb +14 -0
  50. data/spec/mbrao/parser_spec.rb +19 -19
  51. data/spec/mbrao/parsing_engines/base_spec.rb +12 -12
  52. data/spec/mbrao/parsing_engines/plain_text_spec.rb +21 -21
  53. data/spec/mbrao/rendering_engines/base_spec.rb +2 -2
  54. data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +31 -31
  55. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd6d93dc6faccb2e60832cd503f75f0486eee87d
4
- data.tar.gz: be1cdc43c5499e7ae2846bd767290d5feef6eacf
3
+ metadata.gz: 2d8cdcece5127a52606743fb1f1a5b60fd263d85
4
+ data.tar.gz: e82bfb645863252bc1b0d0cbb59361306bf41a22
5
5
  SHA512:
6
- metadata.gz: bdc3b31d0c604b703a114ff3f301e151563701194038d573fb81a32de1a70d4d9b9135f5b301cfe7b59aea913c39cf266348ad691e4c913360a9382e17a6c61c
7
- data.tar.gz: f5463211a9484aff39d21b6569ecef97d28de6e90f6235b0d9bbf31f5aade4af6c296737ca5db28f0364c60a31e718830e7850a8fc4d9493b7ee3f0ea9767f51
6
+ metadata.gz: 16b211a2ec3906a47096e415321e428ae7d3b354214da7b7f94fcb5a70ee5317216719d424bfb61719b7e25e6e2cc658f8267d2ec48b01762c9ad9d796d96718
7
+ data.tar.gz: a38360d95c6f0232983bbd3f9b5d4a653724c947c71be850a2e92655e47d4e04ff261c978068a9518726e98fe5fcf858ed6acb9617b8bbfbdbd96eb462bb2c47
data/.gitignore CHANGED
@@ -4,3 +4,6 @@ coverage/
4
4
  pkg/
5
5
  .idea/
6
6
  .yardoc/
7
+ metrics/
8
+ .metrics
9
+ tmp/metric_fu
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 1.3.0 / 2013-11-24
2
+
3
+ * Added #as_json methods for Content and Author.
4
+ * Cleaned up the code.
5
+
1
6
  ### 1.2.3 / 2013-11-23
2
7
 
3
8
  * Added support for ActiveSupport 4.
@@ -144,6 +144,29 @@
144
144
  <span class="summary_desc"><div class='inline'><p>Returns a unique (singleton) instance of the template handler.</p>
145
145
  </div></span>
146
146
 
147
+ </li>
148
+
149
+
150
+ <li class="public ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#register-class_method" title="register (class method)">+ (Object) <strong>register</strong> </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'><p>Register Mbrao into Rails.</p>
168
+ </div></span>
169
+
147
170
  </li>
148
171
 
149
172
 
@@ -312,6 +335,46 @@
312
335
  </td>
313
336
  </tr>
314
337
  </table>
338
+ </div>
339
+
340
+ <div class="method_details ">
341
+ <h3 class="signature " id="register-class_method">
342
+
343
+ + (<tt>Object</tt>) <strong>register</strong>
344
+
345
+
346
+
347
+
348
+
349
+ </h3><div class="docstring">
350
+ <div class="discussion">
351
+ <p>Register Mbrao into Rails.</p>
352
+
353
+
354
+ </div>
355
+ </div>
356
+ <div class="tags">
357
+
358
+
359
+ </div><table class="source_code">
360
+ <tr>
361
+ <td>
362
+ <pre class="lines">
363
+
364
+
365
+ 21
366
+ 22
367
+ 23</pre>
368
+ </td>
369
+ <td>
370
+ <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 21</span>
371
+
372
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</span>
373
+ <span class='const'>ActionView</span><span class='op'>::</span><span class='const'>Template</span><span class='period'>.</span><span class='id identifier rubyid_register_template_handler'>register_template_handler</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>emt</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_instance'>instance</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>ActionView</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>Rails</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[34]</span><span class='regexp_end'>/</span></span>
374
+ <span class='kw'>end</span></pre>
375
+ </td>
376
+ </tr>
377
+ </table>
315
378
  </div>
316
379
 
317
380
  </div>
@@ -381,12 +444,12 @@
381
444
  <pre class="lines">
382
445
 
383
446
 
384
- 45
385
- 46
386
- 47</pre>
447
+ 52
448
+ 53
449
+ 54</pre>
387
450
  </td>
388
451
  <td>
389
- <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 45</span>
452
+ <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 52</span>
390
453
 
391
454
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_template'>template</span><span class='rparen'>)</span>
392
455
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ActionView::Template::Handlers::MbraoTemplate.instance.render(self, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
@@ -472,25 +535,29 @@
472
535
  <pre class="lines">
473
536
 
474
537
 
475
- 25
476
- 26
477
- 27
478
- 28
479
- 29
480
538
  30
481
539
  31
482
- 32</pre>
540
+ 32
541
+ 33
542
+ 34
543
+ 35
544
+ 36
545
+ 37
546
+ 38
547
+ 39</pre>
483
548
  </td>
484
549
  <td>
485
- <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 25</span>
550
+ <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 30</span>
486
551
 
487
552
  <span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_renderer'>renderer</span><span class='comma'>,</span> <span class='id identifier rubyid_template'>template</span><span class='rparen'>)</span>
488
553
  <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_template'>template</span><span class='rparen'>)</span>
489
- <span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:@mbrao_content</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
490
- <span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_define_singleton_method'>define_singleton_method</span><span class='lparen'>(</span><span class='symbol'>:mbrao_content</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='ivar'>@mbrao_content</span> <span class='rbrace'>}</span>
491
- <span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:helper_method</span><span class='comma'>,</span> <span class='symbol'>:mbrao_content</span><span class='rparen'>)</span>
554
+ <span class='id identifier rubyid_controller'>controller</span> <span class='op'>=</span> <span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span>
492
555
 
493
- <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>engine:</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_metadata'>metadata</span><span class='lbracket'>[</span><span class='symbol'>:engine</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>locale:</span> <span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='rparen'>)</span>
556
+ <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:@mbrao_content</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
557
+ <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_define_singleton_method'>define_singleton_method</span><span class='lparen'>(</span><span class='symbol'>:mbrao_content</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='ivar'>@mbrao_content</span> <span class='rbrace'>}</span>
558
+ <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:helper_method</span><span class='comma'>,</span> <span class='symbol'>:mbrao_content</span><span class='rparen'>)</span>
559
+
560
+ <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>engine:</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_metadata'>metadata</span><span class='lbracket'>[</span><span class='symbol'>:engine</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>locale:</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:locale</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='rparen'>)</span>
494
561
  <span class='kw'>end</span></pre>
495
562
  </td>
496
563
  </tr>
@@ -539,12 +606,12 @@
539
606
  <pre class="lines">
540
607
 
541
608
 
542
- 37
543
- 38
544
- 39</pre>
609
+ 44
610
+ 45
611
+ 46</pre>
545
612
  </td>
546
613
  <td>
547
- <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 37</span>
614
+ <pre class="code"><span class="info file"># File 'lib/mbrao/integrations/rails.rb', line 44</span>
548
615
 
549
616
  <span class='kw'>def</span> <span class='id identifier rubyid_supports_streaming?'>supports_streaming?</span>
550
617
  <span class='kw'>true</span>
@@ -559,7 +626,7 @@
559
626
  </div>
560
627
 
561
628
  <div id="footer">
562
- Generated on Sat Nov 23 13:44:02 2013 by
629
+ Generated on Sun Nov 24 14:07:04 2013 by
563
630
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
564
631
  0.8.7.3 (ruby-2.0.0).
565
632
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sat Nov 23 13:44:01 2013 by
119
+ Generated on Sun Nov 24 14:07:03 2013 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.0.0).
122
122
  </div>
@@ -345,7 +345,7 @@
345
345
  </div>
346
346
 
347
347
  <div id="footer">
348
- Generated on Sat Nov 23 13:44:02 2013 by
348
+ Generated on Sun Nov 24 14:07:04 2013 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.0.0).
351
351
  </div>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
 
133
133
  <div id="footer">
134
- Generated on Sat Nov 23 13:44:02 2013 by
134
+ Generated on Sun Nov 24 14:07:04 2013 by
135
135
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
136
136
  0.8.7.3 (ruby-2.0.0).
137
137
  </div>
data/doc/HTML.html CHANGED
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sat Nov 23 13:44:01 2013 by
119
+ Generated on Sun Nov 24 14:07:03 2013 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.0.0).
122
122
  </div>