mbrao 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/ActionView/Template/Handlers.html +1 -1
- data/doc/ActionView/Template/Handlers/MbraoTemplate.html +1 -1
- data/doc/HTML.html +1 -1
- data/doc/HTML/Pipeline.html +1 -1
- data/doc/HTML/Pipeline/KramdownFilter.html +1 -1
- data/doc/Mbrao.html +1 -1
- data/doc/Mbrao/Author.html +1 -1
- data/doc/Mbrao/Content.html +1 -1
- data/doc/Mbrao/ContentPublicInterface.html +1 -1
- data/doc/Mbrao/Exceptions.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidDate.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidMetadata.html +1 -1
- data/doc/Mbrao/Exceptions/Parsing.html +1 -1
- data/doc/Mbrao/Exceptions/Rendering.html +1 -1
- data/doc/Mbrao/Exceptions/UnavailableLocalization.html +1 -1
- data/doc/Mbrao/Exceptions/Unimplemented.html +1 -1
- data/doc/Mbrao/Exceptions/UnknownEngine.html +1 -1
- data/doc/Mbrao/Parser.html +9 -9
- data/doc/Mbrao/ParsingEngines.html +1 -1
- data/doc/Mbrao/ParsingEngines/Base.html +1 -1
- data/doc/Mbrao/ParsingEngines/PlainText.html +1 -1
- data/doc/Mbrao/PublicInterface.html +1 -1
- data/doc/Mbrao/PublicInterface/ClassMethods.html +29 -13
- data/doc/Mbrao/RenderingEngines.html +1 -1
- data/doc/Mbrao/RenderingEngines/Base.html +1 -1
- data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +1 -1
- data/doc/Mbrao/Validations.html +1 -1
- data/doc/Mbrao/Validations/ClassMethods.html +17 -17
- data/doc/Mbrao/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/top-level-namespace.html +1 -1
- data/lib/mbrao/parser.rb +3 -1
- data/lib/mbrao/version.rb +1 -1
- data/spec/mbrao/parser_spec.rb +1 -0
- metadata +2 -2
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on Fri Mar 8 09:
|
119
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.5.2 (ruby-1.9.3).
|
122
122
|
</div>
|
@@ -559,7 +559,7 @@
|
|
559
559
|
</div>
|
560
560
|
|
561
561
|
<div id="footer">
|
562
|
-
Generated on Fri Mar 8 09:
|
562
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
563
563
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
564
564
|
0.8.5.2 (ruby-1.9.3).
|
565
565
|
</div>
|
data/doc/HTML.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on Fri Mar 8 09:
|
119
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.5.2 (ruby-1.9.3).
|
122
122
|
</div>
|
data/doc/HTML/Pipeline.html
CHANGED
@@ -131,7 +131,7 @@
|
|
131
131
|
</div>
|
132
132
|
|
133
133
|
<div id="footer">
|
134
|
-
Generated on Fri Mar 8 09:
|
134
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
135
135
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
136
136
|
0.8.5.2 (ruby-1.9.3).
|
137
137
|
</div>
|
@@ -345,7 +345,7 @@
|
|
345
345
|
</div>
|
346
346
|
|
347
347
|
<div id="footer">
|
348
|
-
Generated on Fri Mar 8 09:
|
348
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
349
349
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
350
350
|
0.8.5.2 (ruby-1.9.3).
|
351
351
|
</div>
|
data/doc/Mbrao.html
CHANGED
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on Fri Mar 8 09:
|
124
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.8.5.2 (ruby-1.9.3).
|
127
127
|
</div>
|
data/doc/Mbrao/Author.html
CHANGED
@@ -1393,7 +1393,7 @@
|
|
1393
1393
|
</div>
|
1394
1394
|
|
1395
1395
|
<div id="footer">
|
1396
|
-
Generated on Fri Mar 8 09:
|
1396
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
1397
1397
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1398
1398
|
0.8.5.2 (ruby-1.9.3).
|
1399
1399
|
</div>
|
data/doc/Mbrao/Content.html
CHANGED
@@ -4770,7 +4770,7 @@
|
|
4770
4770
|
</div>
|
4771
4771
|
|
4772
4772
|
<div id="footer">
|
4773
|
-
Generated on Fri Mar 8 09:
|
4773
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
4774
4774
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
4775
4775
|
0.8.5.2 (ruby-1.9.3).
|
4776
4776
|
</div>
|
@@ -649,7 +649,7 @@
|
|
649
649
|
</div>
|
650
650
|
|
651
651
|
<div id="footer">
|
652
|
-
Generated on Fri Mar 8 09:
|
652
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
653
653
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
654
654
|
0.8.5.2 (ruby-1.9.3).
|
655
655
|
</div>
|
data/doc/Mbrao/Exceptions.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on Fri Mar 8 09:
|
119
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.5.2 (ruby-1.9.3).
|
122
122
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Mar 8 09:
|
127
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.5.2 (ruby-1.9.3).
|
130
130
|
</div>
|
data/doc/Mbrao/Parser.html
CHANGED
@@ -275,13 +275,13 @@
|
|
275
275
|
<pre class="lines">
|
276
276
|
|
277
277
|
|
278
|
-
233
|
279
|
-
234
|
280
278
|
235
|
281
|
-
236
|
279
|
+
236
|
280
|
+
237
|
281
|
+
238</pre>
|
282
282
|
</td>
|
283
283
|
<td>
|
284
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
284
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 235</span>
|
285
285
|
|
286
286
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
287
287
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_parsing_options'>sanitize_parsing_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
@@ -387,13 +387,13 @@
|
|
387
387
|
<pre class="lines">
|
388
388
|
|
389
389
|
|
390
|
-
244
|
391
|
-
245
|
392
390
|
246
|
393
|
-
247
|
391
|
+
247
|
392
|
+
248
|
393
|
+
249</pre>
|
394
394
|
</td>
|
395
395
|
<td>
|
396
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
396
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 246</span>
|
397
397
|
|
398
398
|
<span class='kw'>def</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='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
399
399
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_rendering_options'>sanitize_rendering_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
@@ -409,7 +409,7 @@
|
|
409
409
|
</div>
|
410
410
|
|
411
411
|
<div id="footer">
|
412
|
-
Generated on Fri Mar 8 09:
|
412
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
413
413
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
414
414
|
0.8.5.2 (ruby-1.9.3).
|
415
415
|
</div>
|
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on Fri Mar 8 09:
|
121
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
123
|
0.8.5.2 (ruby-1.9.3).
|
124
124
|
</div>
|
@@ -649,7 +649,7 @@
|
|
649
649
|
</div>
|
650
650
|
|
651
651
|
<div id="footer">
|
652
|
-
Generated on Fri Mar 8 09:
|
652
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
653
653
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
654
654
|
0.8.5.2 (ruby-1.9.3).
|
655
655
|
</div>
|
@@ -562,7 +562,7 @@
|
|
562
562
|
</div>
|
563
563
|
|
564
564
|
<div id="footer">
|
565
|
-
Generated on Fri Mar 8 09:
|
565
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
566
566
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
567
567
|
0.8.5.2 (ruby-1.9.3).
|
568
568
|
</div>
|
@@ -125,7 +125,7 @@
|
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div id="footer">
|
128
|
-
Generated on Fri Mar 8 09:
|
128
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
129
129
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
130
130
|
0.8.5.2 (ruby-1.9.3).
|
131
131
|
</div>
|
@@ -487,7 +487,9 @@
|
|
487
487
|
121
|
488
488
|
122
|
489
489
|
123
|
490
|
-
124
|
490
|
+
124
|
491
|
+
125
|
492
|
+
126</pre>
|
491
493
|
</td>
|
492
494
|
<td>
|
493
495
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 21</span>
|
@@ -553,7 +555,7 @@
|
|
553
555
|
|
554
556
|
<span class='comment'># Finds a class to instantiate.
|
555
557
|
</span> <span class='comment'>#
|
556
|
-
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
558
|
+
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol` or a `Class`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
557
559
|
</span> <span class='comment'># @param scope [String] An additional scope to find the class. `%CLASS%` will be substituted with the class name.
|
558
560
|
</span> <span class='comment'># @param only_in_scope [Boolean] If only try to instantiate the class in the scope.
|
559
561
|
</span> <span class='comment'># @return [Class] The found class.
|
@@ -570,6 +572,8 @@
|
|
570
572
|
|
571
573
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%CLASS%</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_cls'>cls</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^::</span><span class='regexp_end'>/</span></span> <span class='op'>&&</span> <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
572
574
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
575
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span>
|
576
|
+
<span class='id identifier rubyid_cls'>cls</span>
|
573
577
|
<span class='kw'>else</span>
|
574
578
|
<span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
575
579
|
<span class='kw'>end</span>
|
@@ -807,7 +811,9 @@
|
|
807
811
|
121
|
808
812
|
122
|
809
813
|
123
|
810
|
-
124
|
814
|
+
124
|
815
|
+
125
|
816
|
+
126</pre>
|
811
817
|
</td>
|
812
818
|
<td>
|
813
819
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 21</span>
|
@@ -873,7 +879,7 @@
|
|
873
879
|
|
874
880
|
<span class='comment'># Finds a class to instantiate.
|
875
881
|
</span> <span class='comment'>#
|
876
|
-
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
882
|
+
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol` or a `Class`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
877
883
|
</span> <span class='comment'># @param scope [String] An additional scope to find the class. `%CLASS%` will be substituted with the class name.
|
878
884
|
</span> <span class='comment'># @param only_in_scope [Boolean] If only try to instantiate the class in the scope.
|
879
885
|
</span> <span class='comment'># @return [Class] The found class.
|
@@ -890,6 +896,8 @@
|
|
890
896
|
|
891
897
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%CLASS%</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_cls'>cls</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^::</span><span class='regexp_end'>/</span></span> <span class='op'>&&</span> <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
892
898
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
899
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span>
|
900
|
+
<span class='id identifier rubyid_cls'>cls</span>
|
893
901
|
<span class='kw'>else</span>
|
894
902
|
<span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
895
903
|
<span class='kw'>end</span>
|
@@ -1068,7 +1076,9 @@
|
|
1068
1076
|
121
|
1069
1077
|
122
|
1070
1078
|
123
|
1071
|
-
124
|
1079
|
+
124
|
1080
|
+
125
|
1081
|
+
126</pre>
|
1072
1082
|
</td>
|
1073
1083
|
<td>
|
1074
1084
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 21</span>
|
@@ -1134,7 +1144,7 @@
|
|
1134
1144
|
|
1135
1145
|
<span class='comment'># Finds a class to instantiate.
|
1136
1146
|
</span> <span class='comment'>#
|
1137
|
-
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
1147
|
+
</span> <span class='comment'># @param cls [Symbol|String|Object] If a `String` or a `Symbol` or a `Class`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
1138
1148
|
</span> <span class='comment'># @param scope [String] An additional scope to find the class. `%CLASS%` will be substituted with the class name.
|
1139
1149
|
</span> <span class='comment'># @param only_in_scope [Boolean] If only try to instantiate the class in the scope.
|
1140
1150
|
</span> <span class='comment'># @return [Class] The found class.
|
@@ -1151,6 +1161,8 @@
|
|
1151
1161
|
|
1152
1162
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%CLASS%</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_cls'>cls</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^::</span><span class='regexp_end'>/</span></span> <span class='op'>&&</span> <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1153
1163
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1164
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span>
|
1165
|
+
<span class='id identifier rubyid_cls'>cls</span>
|
1154
1166
|
<span class='kw'>else</span>
|
1155
1167
|
<span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
1156
1168
|
<span class='kw'>end</span>
|
@@ -1322,7 +1334,7 @@
|
|
1322
1334
|
|
1323
1335
|
|
1324
1336
|
—
|
1325
|
-
<div class='inline'><p>If a <code>String</code> or a <code>Symbol</code>, then it will be the class to instantiate. Otherwise the class of the object will returned.</p>
|
1337
|
+
<div class='inline'><p>If a <code>String</code> or a <code>Symbol</code> or a <code>Class</code>, then it will be the class to instantiate. Otherwise the class of the object will returned.</p>
|
1326
1338
|
</div>
|
1327
1339
|
|
1328
1340
|
</li>
|
@@ -1403,7 +1415,9 @@
|
|
1403
1415
|
99
|
1404
1416
|
100
|
1405
1417
|
101
|
1406
|
-
102
|
1418
|
+
102
|
1419
|
+
103
|
1420
|
+
104</pre>
|
1407
1421
|
</td>
|
1408
1422
|
<td>
|
1409
1423
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 86</span>
|
@@ -1421,6 +1435,8 @@
|
|
1421
1435
|
|
1422
1436
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%CLASS%</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_rv'>rv</span> <span class='op'>&&</span> <span class='id identifier rubyid_cls'>cls</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^::</span><span class='regexp_end'>/</span></span> <span class='op'>&&</span> <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1423
1437
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>||</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1438
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span>
|
1439
|
+
<span class='id identifier rubyid_cls'>cls</span>
|
1424
1440
|
<span class='kw'>else</span>
|
1425
1441
|
<span class='id identifier rubyid_cls'>cls</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
1426
1442
|
<span class='kw'>end</span>
|
@@ -1493,13 +1509,13 @@
|
|
1493
1509
|
<pre class="lines">
|
1494
1510
|
|
1495
1511
|
|
1496
|
-
108
|
1497
|
-
109
|
1498
1512
|
110
|
1499
|
-
111
|
1513
|
+
111
|
1514
|
+
112
|
1515
|
+
113</pre>
|
1500
1516
|
</td>
|
1501
1517
|
<td>
|
1502
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
1518
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 110</span>
|
1503
1519
|
|
1504
1520
|
<span class='kw'>def</span> <span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1505
1521
|
<span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
|
@@ -1718,7 +1734,7 @@
|
|
1718
1734
|
</div>
|
1719
1735
|
|
1720
1736
|
<div id="footer">
|
1721
|
-
Generated on Fri Mar 8 09:
|
1737
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
1722
1738
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1723
1739
|
0.8.5.2 (ruby-1.9.3).
|
1724
1740
|
</div>
|
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on Fri Mar 8 09:
|
121
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
123
|
0.8.5.2 (ruby-1.9.3).
|
124
124
|
</div>
|
@@ -271,7 +271,7 @@
|
|
271
271
|
</div>
|
272
272
|
|
273
273
|
<div id="footer">
|
274
|
-
Generated on Fri Mar 8 09:
|
274
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
275
275
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
276
276
|
0.8.5.2 (ruby-1.9.3).
|
277
277
|
</div>
|
@@ -864,7 +864,7 @@
|
|
864
864
|
</div>
|
865
865
|
|
866
866
|
<div id="footer">
|
867
|
-
Generated on Fri Mar 8 09:
|
867
|
+
Generated on Fri Mar 8 09:15:25 2013 by
|
868
868
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
869
869
|
0.8.5.2 (ruby-1.9.3).
|
870
870
|
</div>
|
data/doc/Mbrao/Validations.html
CHANGED
@@ -125,7 +125,7 @@
|
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div id="footer">
|
128
|
-
Generated on Fri Mar 8 09:
|
128
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
129
129
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
130
130
|
0.8.5.2 (ruby-1.9.3).
|
131
131
|
</div>
|
@@ -271,13 +271,13 @@
|
|
271
271
|
<pre class="lines">
|
272
272
|
|
273
273
|
|
274
|
-
137
|
275
|
-
138
|
276
274
|
139
|
277
|
-
140
|
275
|
+
140
|
276
|
+
141
|
277
|
+
142</pre>
|
278
278
|
</td>
|
279
279
|
<td>
|
280
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
280
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 139</span>
|
281
281
|
|
282
282
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
283
283
|
<span class='id identifier rubyid_regex'>regex</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$</span><span class='regexp_end'>/i</span></span>
|
@@ -349,8 +349,6 @@
|
|
349
349
|
<pre class="lines">
|
350
350
|
|
351
351
|
|
352
|
-
146
|
353
|
-
147
|
354
352
|
148
|
355
353
|
149
|
356
354
|
150
|
@@ -362,10 +360,12 @@
|
|
362
360
|
156
|
363
361
|
157
|
364
362
|
158
|
365
|
-
159
|
363
|
+
159
|
364
|
+
160
|
365
|
+
161</pre>
|
366
366
|
</td>
|
367
367
|
<td>
|
368
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
368
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 148</span>
|
369
369
|
|
370
370
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
371
371
|
<span class='id identifier rubyid_regex'>regex</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>
|
@@ -513,8 +513,6 @@
|
|
513
513
|
<pre class="lines">
|
514
514
|
|
515
515
|
|
516
|
-
188
|
517
|
-
189
|
518
516
|
190
|
519
517
|
191
|
520
518
|
192
|
@@ -527,10 +525,12 @@
|
|
527
525
|
199
|
528
526
|
200
|
529
527
|
201
|
530
|
-
202
|
528
|
+
202
|
529
|
+
203
|
530
|
+
204</pre>
|
531
531
|
</td>
|
532
532
|
<td>
|
533
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
533
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 190</span>
|
534
534
|
|
535
535
|
<span class='kw'>def</span> <span class='id identifier rubyid_sanitized_array'>sanitized_array</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitize_method'>sanitize_method</span> <span class='op'>=</span> <span class='symbol'>:ensure_string</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
536
536
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
|
@@ -645,8 +645,6 @@
|
|
645
645
|
<pre class="lines">
|
646
646
|
|
647
647
|
|
648
|
-
167
|
649
|
-
168
|
650
648
|
169
|
651
649
|
170
|
652
650
|
171
|
@@ -656,10 +654,12 @@
|
|
656
654
|
175
|
657
655
|
176
|
658
656
|
177
|
659
|
-
178
|
657
|
+
178
|
658
|
+
179
|
659
|
+
180</pre>
|
660
660
|
</td>
|
661
661
|
<td>
|
662
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line
|
662
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parser.rb', line 169</span>
|
663
663
|
|
664
664
|
<span class='kw'>def</span> <span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitize_method'>sanitize_method</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
665
665
|
<span class='kw'>if</span> <span class='id identifier rubyid_object'>object</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='op'>||</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>HashWithIndifferentAccess</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
@@ -683,7 +683,7 @@
|
|
683
683
|
</div>
|
684
684
|
|
685
685
|
<div id="footer">
|
686
|
-
Generated on Fri Mar 8 09:
|
686
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
687
687
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
688
688
|
0.8.5.2 (ruby-1.9.3).
|
689
689
|
</div>
|
data/doc/Mbrao/Version.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>3</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on Fri Mar 8 09:
|
183
|
+
Generated on Fri Mar 8 09:15:24 2013 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.5.2 (ruby-1.9.3).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -386,7 +386,7 @@
|
|
386
386
|
</div>
|
387
387
|
|
388
388
|
<div id="footer">
|
389
|
-
Generated on Fri Mar 8 09:
|
389
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
390
390
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
391
391
|
0.8.5.2 (ruby-1.9.3).
|
392
392
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -128,7 +128,7 @@ Mbrao::Parser.render(content)
|
|
128
128
|
</div></div>
|
129
129
|
|
130
130
|
<div id="footer">
|
131
|
-
Generated on Fri Mar 8 09:
|
131
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
132
132
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
133
133
|
0.8.5.2 (ruby-1.9.3).
|
134
134
|
</div>
|
data/doc/index.html
CHANGED
@@ -128,7 +128,7 @@ Mbrao::Parser.render(content)
|
|
128
128
|
</div></div>
|
129
129
|
|
130
130
|
<div id="footer">
|
131
|
-
Generated on Fri Mar 8 09:
|
131
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
132
132
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
133
133
|
0.8.5.2 (ruby-1.9.3).
|
134
134
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on Fri Mar 8 09:
|
106
|
+
Generated on Fri Mar 8 09:15:23 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.5.2 (ruby-1.9.3).
|
109
109
|
</div>
|
data/lib/mbrao/parser.rb
CHANGED
@@ -79,7 +79,7 @@ module Mbrao
|
|
79
79
|
|
80
80
|
# Finds a class to instantiate.
|
81
81
|
#
|
82
|
-
# @param cls [Symbol|String|Object] If a `String` or a `Symbol`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
82
|
+
# @param cls [Symbol|String|Object] If a `String` or a `Symbol` or a `Class`, then it will be the class to instantiate. Otherwise the class of the object will returned.
|
83
83
|
# @param scope [String] An additional scope to find the class. `%CLASS%` will be substituted with the class name.
|
84
84
|
# @param only_in_scope [Boolean] If only try to instantiate the class in the scope.
|
85
85
|
# @return [Class] The found class.
|
@@ -96,6 +96,8 @@ module Mbrao
|
|
96
96
|
|
97
97
|
rv = (scope.ensure_string.gsub("%CLASS%", cls).constantize rescue nil) if !rv && cls !~ /^::/ && scope.present?
|
98
98
|
rv || raise(Mbrao::Exceptions::Unimplemented.new(cls))
|
99
|
+
elsif cls.is_a?(Class)
|
100
|
+
cls
|
99
101
|
else
|
100
102
|
cls.class
|
101
103
|
end
|
data/lib/mbrao/version.rb
CHANGED
data/spec/mbrao/parser_spec.rb
CHANGED
@@ -97,6 +97,7 @@ describe Mbrao::Parser do
|
|
97
97
|
expect(::Mbrao::Parser.find_class(1)).to eq(Fixnum)
|
98
98
|
expect(::Mbrao::Parser.find_class(["A"])).to eq(Array)
|
99
99
|
expect(::Mbrao::Parser.find_class({a: "b"})).to eq(Hash)
|
100
|
+
expect(::Mbrao::Parser.find_class(Hash)).to eq(Hash)
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mbrao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
segments:
|
176
176
|
- 0
|
177
|
-
hash:
|
177
|
+
hash: 2379105030691470614
|
178
178
|
requirements: []
|
179
179
|
rubyforge_project: mbrao
|
180
180
|
rubygems_version: 1.8.25
|