mbrao 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/doc/ActionView/Template/Handlers/MbraoTemplate.html +1 -1
- data/doc/ActionView/Template/Handlers.html +1 -1
- data/doc/HTML/Pipeline/KramdownFilter.html +1 -1
- data/doc/HTML/Pipeline.html +1 -1
- data/doc/HTML.html +1 -1
- data/doc/Mbrao/Author.html +1 -1
- data/doc/Mbrao/Content.html +958 -259
- data/doc/Mbrao/ContentPublicInterface.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/Exceptions.html +1 -1
- data/doc/Mbrao/Parser.html +1 -1
- data/doc/Mbrao/ParsingEngines/Base.html +1 -1
- data/doc/Mbrao/ParsingEngines/PlainText.html +1 -1
- data/doc/Mbrao/ParsingEngines.html +1 -1
- data/doc/Mbrao/PublicInterface/ClassMethods.html +1 -1
- data/doc/Mbrao/PublicInterface.html +1 -1
- data/doc/Mbrao/RenderingEngines/Base.html +1 -1
- data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +1 -1
- data/doc/Mbrao/RenderingEngines.html +1 -1
- data/doc/Mbrao/Validations/ClassMethods.html +1 -1
- data/doc/Mbrao/Validations.html +1 -1
- data/doc/Mbrao/Version.html +2 -2
- data/doc/Mbrao.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +53 -47
- data/doc/top-level-namespace.html +1 -1
- data/lib/mbrao/content.rb +18 -8
- data/lib/mbrao/version.rb +1 -1
- data/spec/mbrao/content_spec.rb +10 -2
- metadata +1 -1
data/doc/Mbrao/Content.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
<li class="public ">
|
150
150
|
<span class="summary_signature">
|
151
151
|
|
152
|
-
<a href="#body-instance_method" title="#body (instance method)">- (String
|
152
|
+
<a href="#body-instance_method" title="#body (instance method)">- (String) <strong>body</strong> </a>
|
153
153
|
|
154
154
|
|
155
155
|
|
@@ -273,6 +273,32 @@
|
|
273
273
|
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute more.</p>
|
274
274
|
</div></span>
|
275
275
|
|
276
|
+
</li>
|
277
|
+
|
278
|
+
|
279
|
+
<li class="public ">
|
280
|
+
<span class="summary_signature">
|
281
|
+
|
282
|
+
<a href="#summary-instance_method" title="#summary (instance method)">- (String|HashWithIndifferentAccess) <strong>summary</strong> </a>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</span>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
<span class="summary_desc"><div class='inline'><p>The content’s summary.</p>
|
300
|
+
</div></span>
|
301
|
+
|
276
302
|
</li>
|
277
303
|
|
278
304
|
|
@@ -559,12 +585,12 @@
|
|
559
585
|
<pre class="lines">
|
560
586
|
|
561
587
|
|
562
|
-
|
563
|
-
|
564
|
-
|
588
|
+
137
|
589
|
+
138
|
590
|
+
139</pre>
|
565
591
|
</td>
|
566
592
|
<td>
|
567
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
593
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 137</span>
|
568
594
|
|
569
595
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
570
596
|
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
@@ -623,8 +649,6 @@
|
|
623
649
|
<pre class="lines">
|
624
650
|
|
625
651
|
|
626
|
-
117
|
627
|
-
118
|
628
652
|
119
|
629
653
|
120
|
630
654
|
121
|
@@ -852,10 +876,20 @@
|
|
852
876
|
343
|
853
877
|
344
|
854
878
|
345
|
855
|
-
346
|
879
|
+
346
|
880
|
+
347
|
881
|
+
348
|
882
|
+
349
|
883
|
+
350
|
884
|
+
351
|
885
|
+
352
|
886
|
+
353
|
887
|
+
354
|
888
|
+
355
|
889
|
+
356</pre>
|
856
890
|
</td>
|
857
891
|
<td>
|
858
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
892
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
859
893
|
|
860
894
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
861
895
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -863,6 +897,7 @@
|
|
863
897
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
864
898
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
865
899
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
900
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
866
901
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
867
902
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
868
903
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -893,6 +928,14 @@
|
|
893
928
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
894
929
|
<span class='kw'>end</span>
|
895
930
|
|
931
|
+
<span class='comment'># Sets the `summary` attribute.
|
932
|
+
</span> <span class='comment'>#
|
933
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
934
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
935
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
936
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
937
|
+
<span class='kw'>end</span>
|
938
|
+
|
896
939
|
<span class='comment'># Sets the `body` attribute.
|
897
940
|
</span> <span class='comment'>#
|
898
941
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -953,7 +996,7 @@
|
|
953
996
|
</span> <span class='comment'>#
|
954
997
|
</span> <span class='comment'># @return The metadata attribute.
|
955
998
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
956
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
999
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
957
1000
|
<span class='kw'>end</span>
|
958
1001
|
|
959
1002
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -976,7 +1019,7 @@
|
|
976
1019
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
977
1020
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
978
1021
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
979
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
1022
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
980
1023
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
981
1024
|
<span class='kw'>end</span>
|
982
1025
|
|
@@ -1001,7 +1044,7 @@
|
|
1001
1044
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
1002
1045
|
<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>
|
1003
1046
|
<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>
|
1004
|
-
<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='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>
|
1047
|
+
<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>
|
1005
1048
|
<span class='id identifier rubyid_rv'>rv</span>
|
1006
1049
|
<span class='kw'>end</span>
|
1007
1050
|
|
@@ -1012,10 +1055,9 @@
|
|
1012
1055
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
1013
1056
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
1014
1057
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
1015
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
1016
|
-
|
1017
1058
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
1018
1059
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
1060
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
1019
1061
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1020
1062
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
1021
1063
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -1097,7 +1139,7 @@
|
|
1097
1139
|
<div class="method_details ">
|
1098
1140
|
<h3 class="signature " id="body-instance_method">
|
1099
1141
|
|
1100
|
-
- (<tt>String
|
1142
|
+
- (<tt>String</tt>) <strong>body</strong>
|
1101
1143
|
|
1102
1144
|
|
1103
1145
|
|
@@ -1105,8 +1147,7 @@
|
|
1105
1147
|
|
1106
1148
|
</h3><div class="docstring">
|
1107
1149
|
<div class="discussion">
|
1108
|
-
<p>Returns The content’s body
|
1109
|
-
for multiple locales.</p>
|
1150
|
+
<p>Returns The content’s body.</p>
|
1110
1151
|
|
1111
1152
|
|
1112
1153
|
</div>
|
@@ -1119,13 +1160,12 @@ for multiple locales.</p>
|
|
1119
1160
|
<li>
|
1120
1161
|
|
1121
1162
|
|
1122
|
-
<span class='type'>(<tt>String
|
1163
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1123
1164
|
|
1124
1165
|
|
1125
1166
|
|
1126
1167
|
—
|
1127
|
-
<div class='inline'><p>The content’s body
|
1128
|
-
for multiple locales.</p>
|
1168
|
+
<div class='inline'><p>The content’s body.</p>
|
1129
1169
|
</div>
|
1130
1170
|
|
1131
1171
|
</li>
|
@@ -1138,8 +1178,6 @@ for multiple locales.</p>
|
|
1138
1178
|
<pre class="lines">
|
1139
1179
|
|
1140
1180
|
|
1141
|
-
117
|
1142
|
-
118
|
1143
1181
|
119
|
1144
1182
|
120
|
1145
1183
|
121
|
@@ -1367,10 +1405,20 @@ for multiple locales.</p>
|
|
1367
1405
|
343
|
1368
1406
|
344
|
1369
1407
|
345
|
1370
|
-
346
|
1408
|
+
346
|
1409
|
+
347
|
1410
|
+
348
|
1411
|
+
349
|
1412
|
+
350
|
1413
|
+
351
|
1414
|
+
352
|
1415
|
+
353
|
1416
|
+
354
|
1417
|
+
355
|
1418
|
+
356</pre>
|
1371
1419
|
</td>
|
1372
1420
|
<td>
|
1373
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
1421
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
1374
1422
|
|
1375
1423
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
1376
1424
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -1378,6 +1426,7 @@ for multiple locales.</p>
|
|
1378
1426
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
1379
1427
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
1380
1428
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
1429
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
1381
1430
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
1382
1431
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
1383
1432
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -1408,6 +1457,14 @@ for multiple locales.</p>
|
|
1408
1457
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1409
1458
|
<span class='kw'>end</span>
|
1410
1459
|
|
1460
|
+
<span class='comment'># Sets the `summary` attribute.
|
1461
|
+
</span> <span class='comment'>#
|
1462
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
1463
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
1464
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
1465
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1466
|
+
<span class='kw'>end</span>
|
1467
|
+
|
1411
1468
|
<span class='comment'># Sets the `body` attribute.
|
1412
1469
|
</span> <span class='comment'>#
|
1413
1470
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -1468,7 +1525,7 @@ for multiple locales.</p>
|
|
1468
1525
|
</span> <span class='comment'>#
|
1469
1526
|
</span> <span class='comment'># @return The metadata attribute.
|
1470
1527
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
1471
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
1528
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1472
1529
|
<span class='kw'>end</span>
|
1473
1530
|
|
1474
1531
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -1491,7 +1548,7 @@ for multiple locales.</p>
|
|
1491
1548
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
1492
1549
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
1493
1550
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
1494
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
1551
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
1495
1552
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1496
1553
|
<span class='kw'>end</span>
|
1497
1554
|
|
@@ -1516,7 +1573,7 @@ for multiple locales.</p>
|
|
1516
1573
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
1517
1574
|
<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>
|
1518
1575
|
<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>
|
1519
|
-
<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='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>
|
1576
|
+
<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>
|
1520
1577
|
<span class='id identifier rubyid_rv'>rv</span>
|
1521
1578
|
<span class='kw'>end</span>
|
1522
1579
|
|
@@ -1527,10 +1584,9 @@ for multiple locales.</p>
|
|
1527
1584
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
1528
1585
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
1529
1586
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
1530
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
1531
|
-
|
1532
1587
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
1533
1588
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
1589
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
1534
1590
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1535
1591
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
1536
1592
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -1651,8 +1707,6 @@ for multiple locales.</p>
|
|
1651
1707
|
<pre class="lines">
|
1652
1708
|
|
1653
1709
|
|
1654
|
-
117
|
1655
|
-
118
|
1656
1710
|
119
|
1657
1711
|
120
|
1658
1712
|
121
|
@@ -1880,10 +1934,20 @@ for multiple locales.</p>
|
|
1880
1934
|
343
|
1881
1935
|
344
|
1882
1936
|
345
|
1883
|
-
346
|
1937
|
+
346
|
1938
|
+
347
|
1939
|
+
348
|
1940
|
+
349
|
1941
|
+
350
|
1942
|
+
351
|
1943
|
+
352
|
1944
|
+
353
|
1945
|
+
354
|
1946
|
+
355
|
1947
|
+
356</pre>
|
1884
1948
|
</td>
|
1885
1949
|
<td>
|
1886
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
1950
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
1887
1951
|
|
1888
1952
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
1889
1953
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -1891,6 +1955,7 @@ for multiple locales.</p>
|
|
1891
1955
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
1892
1956
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
1893
1957
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
1958
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
1894
1959
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
1895
1960
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
1896
1961
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -1921,6 +1986,14 @@ for multiple locales.</p>
|
|
1921
1986
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1922
1987
|
<span class='kw'>end</span>
|
1923
1988
|
|
1989
|
+
<span class='comment'># Sets the `summary` attribute.
|
1990
|
+
</span> <span class='comment'>#
|
1991
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
1992
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
1993
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
1994
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1995
|
+
<span class='kw'>end</span>
|
1996
|
+
|
1924
1997
|
<span class='comment'># Sets the `body` attribute.
|
1925
1998
|
</span> <span class='comment'>#
|
1926
1999
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -1981,7 +2054,7 @@ for multiple locales.</p>
|
|
1981
2054
|
</span> <span class='comment'>#
|
1982
2055
|
</span> <span class='comment'># @return The metadata attribute.
|
1983
2056
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
1984
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
2057
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1985
2058
|
<span class='kw'>end</span>
|
1986
2059
|
|
1987
2060
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -2004,7 +2077,7 @@ for multiple locales.</p>
|
|
2004
2077
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
2005
2078
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
2006
2079
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
2007
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
2080
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
2008
2081
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2009
2082
|
<span class='kw'>end</span>
|
2010
2083
|
|
@@ -2029,7 +2102,7 @@ for multiple locales.</p>
|
|
2029
2102
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
2030
2103
|
<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>
|
2031
2104
|
<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>
|
2032
|
-
<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='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>
|
2105
|
+
<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>
|
2033
2106
|
<span class='id identifier rubyid_rv'>rv</span>
|
2034
2107
|
<span class='kw'>end</span>
|
2035
2108
|
|
@@ -2040,10 +2113,9 @@ for multiple locales.</p>
|
|
2040
2113
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
2041
2114
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
2042
2115
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
2043
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
2044
|
-
|
2045
2116
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
2046
2117
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
2118
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
2047
2119
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2048
2120
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
2049
2121
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -2164,8 +2236,6 @@ for multiple locales.</p>
|
|
2164
2236
|
<pre class="lines">
|
2165
2237
|
|
2166
2238
|
|
2167
|
-
117
|
2168
|
-
118
|
2169
2239
|
119
|
2170
2240
|
120
|
2171
2241
|
121
|
@@ -2393,10 +2463,20 @@ for multiple locales.</p>
|
|
2393
2463
|
343
|
2394
2464
|
344
|
2395
2465
|
345
|
2396
|
-
346
|
2466
|
+
346
|
2467
|
+
347
|
2468
|
+
348
|
2469
|
+
349
|
2470
|
+
350
|
2471
|
+
351
|
2472
|
+
352
|
2473
|
+
353
|
2474
|
+
354
|
2475
|
+
355
|
2476
|
+
356</pre>
|
2397
2477
|
</td>
|
2398
2478
|
<td>
|
2399
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
2479
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
2400
2480
|
|
2401
2481
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
2402
2482
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -2404,6 +2484,7 @@ for multiple locales.</p>
|
|
2404
2484
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
2405
2485
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
2406
2486
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
2487
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
2407
2488
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
2408
2489
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
2409
2490
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -2434,6 +2515,14 @@ for multiple locales.</p>
|
|
2434
2515
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
2435
2516
|
<span class='kw'>end</span>
|
2436
2517
|
|
2518
|
+
<span class='comment'># Sets the `summary` attribute.
|
2519
|
+
</span> <span class='comment'>#
|
2520
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
2521
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
2522
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
2523
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
2524
|
+
<span class='kw'>end</span>
|
2525
|
+
|
2437
2526
|
<span class='comment'># Sets the `body` attribute.
|
2438
2527
|
</span> <span class='comment'>#
|
2439
2528
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -2494,7 +2583,7 @@ for multiple locales.</p>
|
|
2494
2583
|
</span> <span class='comment'>#
|
2495
2584
|
</span> <span class='comment'># @return The metadata attribute.
|
2496
2585
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
2497
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
2586
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
2498
2587
|
<span class='kw'>end</span>
|
2499
2588
|
|
2500
2589
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -2517,7 +2606,7 @@ for multiple locales.</p>
|
|
2517
2606
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
2518
2607
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
2519
2608
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
2520
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
2609
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
2521
2610
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
2522
2611
|
<span class='kw'>end</span>
|
2523
2612
|
|
@@ -2542,7 +2631,7 @@ for multiple locales.</p>
|
|
2542
2631
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
2543
2632
|
<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>
|
2544
2633
|
<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>
|
2545
|
-
<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='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>
|
2634
|
+
<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>
|
2546
2635
|
<span class='id identifier rubyid_rv'>rv</span>
|
2547
2636
|
<span class='kw'>end</span>
|
2548
2637
|
|
@@ -2553,10 +2642,9 @@ for multiple locales.</p>
|
|
2553
2642
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
2554
2643
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
2555
2644
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
2556
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
2557
|
-
|
2558
2645
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
2559
2646
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
2647
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
2560
2648
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2561
2649
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
2562
2650
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -2677,8 +2765,6 @@ for multiple locales.</p>
|
|
2677
2765
|
<pre class="lines">
|
2678
2766
|
|
2679
2767
|
|
2680
|
-
117
|
2681
|
-
118
|
2682
2768
|
119
|
2683
2769
|
120
|
2684
2770
|
121
|
@@ -2906,10 +2992,20 @@ for multiple locales.</p>
|
|
2906
2992
|
343
|
2907
2993
|
344
|
2908
2994
|
345
|
2909
|
-
346
|
2995
|
+
346
|
2996
|
+
347
|
2997
|
+
348
|
2998
|
+
349
|
2999
|
+
350
|
3000
|
+
351
|
3001
|
+
352
|
3002
|
+
353
|
3003
|
+
354
|
3004
|
+
355
|
3005
|
+
356</pre>
|
2910
3006
|
</td>
|
2911
3007
|
<td>
|
2912
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
3008
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
2913
3009
|
|
2914
3010
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
2915
3011
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -2917,6 +3013,7 @@ for multiple locales.</p>
|
|
2917
3013
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
2918
3014
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
2919
3015
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
3016
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
2920
3017
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
2921
3018
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
2922
3019
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -2947,6 +3044,14 @@ for multiple locales.</p>
|
|
2947
3044
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
2948
3045
|
<span class='kw'>end</span>
|
2949
3046
|
|
3047
|
+
<span class='comment'># Sets the `summary` attribute.
|
3048
|
+
</span> <span class='comment'>#
|
3049
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
3050
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
3051
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
3052
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
3053
|
+
<span class='kw'>end</span>
|
3054
|
+
|
2950
3055
|
<span class='comment'># Sets the `body` attribute.
|
2951
3056
|
</span> <span class='comment'>#
|
2952
3057
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -3007,7 +3112,7 @@ for multiple locales.</p>
|
|
3007
3112
|
</span> <span class='comment'>#
|
3008
3113
|
</span> <span class='comment'># @return The metadata attribute.
|
3009
3114
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
3010
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
3115
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
3011
3116
|
<span class='kw'>end</span>
|
3012
3117
|
|
3013
3118
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -3030,7 +3135,7 @@ for multiple locales.</p>
|
|
3030
3135
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
3031
3136
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
3032
3137
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
3033
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
3138
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
3034
3139
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
3035
3140
|
<span class='kw'>end</span>
|
3036
3141
|
|
@@ -3055,7 +3160,7 @@ for multiple locales.</p>
|
|
3055
3160
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
3056
3161
|
<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>
|
3057
3162
|
<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>
|
3058
|
-
<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='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>
|
3163
|
+
<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>
|
3059
3164
|
<span class='id identifier rubyid_rv'>rv</span>
|
3060
3165
|
<span class='kw'>end</span>
|
3061
3166
|
|
@@ -3066,10 +3171,9 @@ for multiple locales.</p>
|
|
3066
3171
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
3067
3172
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
3068
3173
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
3069
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
3070
|
-
|
3071
3174
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
3072
3175
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
3176
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
3073
3177
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
3074
3178
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
3075
3179
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -3173,12 +3277,12 @@ for multiple locales.</p>
|
|
3173
3277
|
<pre class="lines">
|
3174
3278
|
|
3175
3279
|
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3280
|
+
128
|
3281
|
+
129
|
3282
|
+
130</pre>
|
3179
3283
|
</td>
|
3180
3284
|
<td>
|
3181
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
3285
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 128</span>
|
3182
3286
|
|
3183
3287
|
<span class='kw'>def</span> <span class='id identifier rubyid_more'>more</span>
|
3184
3288
|
<span class='ivar'>@more</span>
|
@@ -3189,11 +3293,11 @@ for multiple locales.</p>
|
|
3189
3293
|
</div>
|
3190
3294
|
|
3191
3295
|
|
3192
|
-
<span id="
|
3296
|
+
<span id="summary=-instance_method"></span>
|
3193
3297
|
<div class="method_details ">
|
3194
|
-
<h3 class="signature " id="
|
3298
|
+
<h3 class="signature " id="summary-instance_method">
|
3195
3299
|
|
3196
|
-
- (<tt>
|
3300
|
+
- (<tt>String|HashWithIndifferentAccess</tt>) <strong>summary</strong>
|
3197
3301
|
|
3198
3302
|
|
3199
3303
|
|
@@ -3201,8 +3305,8 @@ for multiple locales.</p>
|
|
3201
3305
|
|
3202
3306
|
</h3><div class="docstring">
|
3203
3307
|
<div class="discussion">
|
3204
|
-
<p>Returns The
|
3205
|
-
|
3308
|
+
<p>Returns The content’s summary. Can be a <code>String</code> or an <code>HashWithIndifferentAccess</code>, if multiple summaries are specified
|
3309
|
+
for multiple locales.</p>
|
3206
3310
|
|
3207
3311
|
|
3208
3312
|
</div>
|
@@ -3215,13 +3319,13 @@ are specified for multiple locales.</p>
|
|
3215
3319
|
<li>
|
3216
3320
|
|
3217
3321
|
|
3218
|
-
<span class='type'>(<tt>
|
3322
|
+
<span class='type'>(<tt>String|HashWithIndifferentAccess</tt>)</span>
|
3219
3323
|
|
3220
3324
|
|
3221
3325
|
|
3222
3326
|
—
|
3223
|
-
<div class='inline'><p>The
|
3224
|
-
|
3327
|
+
<div class='inline'><p>The content’s summary. Can be a <code>String</code> or an <code>HashWithIndifferentAccess</code>, if multiple summaries are specified
|
3328
|
+
for multiple locales.</p>
|
3225
3329
|
</div>
|
3226
3330
|
|
3227
3331
|
</li>
|
@@ -3234,8 +3338,6 @@ are specified for multiple locales.</p>
|
|
3234
3338
|
<pre class="lines">
|
3235
3339
|
|
3236
3340
|
|
3237
|
-
117
|
3238
|
-
118
|
3239
3341
|
119
|
3240
3342
|
120
|
3241
3343
|
121
|
@@ -3463,10 +3565,20 @@ are specified for multiple locales.</p>
|
|
3463
3565
|
343
|
3464
3566
|
344
|
3465
3567
|
345
|
3466
|
-
346
|
3568
|
+
346
|
3569
|
+
347
|
3570
|
+
348
|
3571
|
+
349
|
3572
|
+
350
|
3573
|
+
351
|
3574
|
+
352
|
3575
|
+
353
|
3576
|
+
354
|
3577
|
+
355
|
3578
|
+
356</pre>
|
3467
3579
|
</td>
|
3468
3580
|
<td>
|
3469
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
3581
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
3470
3582
|
|
3471
3583
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
3472
3584
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -3474,6 +3586,7 @@ are specified for multiple locales.</p>
|
|
3474
3586
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
3475
3587
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
3476
3588
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
3589
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
3477
3590
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
3478
3591
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
3479
3592
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -3504,6 +3617,14 @@ are specified for multiple locales.</p>
|
|
3504
3617
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
3505
3618
|
<span class='kw'>end</span>
|
3506
3619
|
|
3620
|
+
<span class='comment'># Sets the `summary` attribute.
|
3621
|
+
</span> <span class='comment'>#
|
3622
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
3623
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
3624
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
3625
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
3626
|
+
<span class='kw'>end</span>
|
3627
|
+
|
3507
3628
|
<span class='comment'># Sets the `body` attribute.
|
3508
3629
|
</span> <span class='comment'>#
|
3509
3630
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -3564,7 +3685,7 @@ are specified for multiple locales.</p>
|
|
3564
3685
|
</span> <span class='comment'>#
|
3565
3686
|
</span> <span class='comment'># @return The metadata attribute.
|
3566
3687
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
3567
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
3688
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
3568
3689
|
<span class='kw'>end</span>
|
3569
3690
|
|
3570
3691
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -3587,7 +3708,7 @@ are specified for multiple locales.</p>
|
|
3587
3708
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
3588
3709
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
3589
3710
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
3590
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
3711
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
3591
3712
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
3592
3713
|
<span class='kw'>end</span>
|
3593
3714
|
|
@@ -3612,7 +3733,7 @@ are specified for multiple locales.</p>
|
|
3612
3733
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
3613
3734
|
<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>
|
3614
3735
|
<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>
|
3615
|
-
<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='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>
|
3736
|
+
<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>
|
3616
3737
|
<span class='id identifier rubyid_rv'>rv</span>
|
3617
3738
|
<span class='kw'>end</span>
|
3618
3739
|
|
@@ -3623,10 +3744,9 @@ are specified for multiple locales.</p>
|
|
3623
3744
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
3624
3745
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
3625
3746
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
3626
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
3627
|
-
|
3628
3747
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
3629
3748
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
3749
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
3630
3750
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
3631
3751
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
3632
3752
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -3704,11 +3824,11 @@ are specified for multiple locales.</p>
|
|
3704
3824
|
</div>
|
3705
3825
|
|
3706
3826
|
|
3707
|
-
<span id="
|
3827
|
+
<span id="tags=-instance_method"></span>
|
3708
3828
|
<div class="method_details ">
|
3709
|
-
<h3 class="signature " id="
|
3829
|
+
<h3 class="signature " id="tags-instance_method">
|
3710
3830
|
|
3711
|
-
- (<tt>
|
3831
|
+
- (<tt>Array|HashWithIndifferentAccess</tt>) <strong>tags</strong>
|
3712
3832
|
|
3713
3833
|
|
3714
3834
|
|
@@ -3716,8 +3836,8 @@ are specified for multiple locales.</p>
|
|
3716
3836
|
|
3717
3837
|
</h3><div class="docstring">
|
3718
3838
|
<div class="discussion">
|
3719
|
-
<p>Returns The content
|
3720
|
-
multiple locales.</p>
|
3839
|
+
<p>Returns The tags associated with the content. Can be an <code>Array</code> or an <code>HashWithIndifferentAccess</code>, if multiple tags set
|
3840
|
+
are specified for multiple locales.</p>
|
3721
3841
|
|
3722
3842
|
|
3723
3843
|
</div>
|
@@ -3730,13 +3850,13 @@ multiple locales.</p>
|
|
3730
3850
|
<li>
|
3731
3851
|
|
3732
3852
|
|
3733
|
-
<span class='type'>(<tt>
|
3853
|
+
<span class='type'>(<tt>Array|HashWithIndifferentAccess</tt>)</span>
|
3734
3854
|
|
3735
3855
|
|
3736
3856
|
|
3737
3857
|
—
|
3738
|
-
<div class='inline'><p>The content
|
3739
|
-
multiple locales.</p>
|
3858
|
+
<div class='inline'><p>The tags associated with the content. Can be an <code>Array</code> or an <code>HashWithIndifferentAccess</code>, if multiple tags set
|
3859
|
+
are specified for multiple locales.</p>
|
3740
3860
|
</div>
|
3741
3861
|
|
3742
3862
|
</li>
|
@@ -3749,8 +3869,6 @@ multiple locales.</p>
|
|
3749
3869
|
<pre class="lines">
|
3750
3870
|
|
3751
3871
|
|
3752
|
-
117
|
3753
|
-
118
|
3754
3872
|
119
|
3755
3873
|
120
|
3756
3874
|
121
|
@@ -3978,10 +4096,20 @@ multiple locales.</p>
|
|
3978
4096
|
343
|
3979
4097
|
344
|
3980
4098
|
345
|
3981
|
-
346
|
4099
|
+
346
|
4100
|
+
347
|
4101
|
+
348
|
4102
|
+
349
|
4103
|
+
350
|
4104
|
+
351
|
4105
|
+
352
|
4106
|
+
353
|
4107
|
+
354
|
4108
|
+
355
|
4109
|
+
356</pre>
|
3982
4110
|
</td>
|
3983
4111
|
<td>
|
3984
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
4112
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
3985
4113
|
|
3986
4114
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
3987
4115
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -3989,6 +4117,7 @@ multiple locales.</p>
|
|
3989
4117
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
3990
4118
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
3991
4119
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
4120
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
3992
4121
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
3993
4122
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
3994
4123
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -4019,6 +4148,14 @@ multiple locales.</p>
|
|
4019
4148
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
4020
4149
|
<span class='kw'>end</span>
|
4021
4150
|
|
4151
|
+
<span class='comment'># Sets the `summary` attribute.
|
4152
|
+
</span> <span class='comment'>#
|
4153
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
4154
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
4155
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
4156
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
4157
|
+
<span class='kw'>end</span>
|
4158
|
+
|
4022
4159
|
<span class='comment'># Sets the `body` attribute.
|
4023
4160
|
</span> <span class='comment'>#
|
4024
4161
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -4079,7 +4216,7 @@ multiple locales.</p>
|
|
4079
4216
|
</span> <span class='comment'>#
|
4080
4217
|
</span> <span class='comment'># @return The metadata attribute.
|
4081
4218
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
4082
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
4219
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
4083
4220
|
<span class='kw'>end</span>
|
4084
4221
|
|
4085
4222
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -4102,7 +4239,7 @@ multiple locales.</p>
|
|
4102
4239
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
4103
4240
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
4104
4241
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
4105
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
4242
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
4106
4243
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
4107
4244
|
<span class='kw'>end</span>
|
4108
4245
|
|
@@ -4127,7 +4264,7 @@ multiple locales.</p>
|
|
4127
4264
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
4128
4265
|
<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>
|
4129
4266
|
<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>
|
4130
|
-
<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='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>
|
4267
|
+
<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>
|
4131
4268
|
<span class='id identifier rubyid_rv'>rv</span>
|
4132
4269
|
<span class='kw'>end</span>
|
4133
4270
|
|
@@ -4138,10 +4275,9 @@ multiple locales.</p>
|
|
4138
4275
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
4139
4276
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
4140
4277
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
4141
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
4142
|
-
|
4143
4278
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
4144
4279
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
4280
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
4145
4281
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
4146
4282
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
4147
4283
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -4219,11 +4355,11 @@ multiple locales.</p>
|
|
4219
4355
|
</div>
|
4220
4356
|
|
4221
4357
|
|
4222
|
-
<span id="
|
4358
|
+
<span id="title=-instance_method"></span>
|
4223
4359
|
<div class="method_details ">
|
4224
|
-
<h3 class="signature " id="
|
4360
|
+
<h3 class="signature " id="title-instance_method">
|
4225
4361
|
|
4226
|
-
- (<tt>String</tt>) <strong>
|
4362
|
+
- (<tt>String|HashWithIndifferentAccess</tt>) <strong>title</strong>
|
4227
4363
|
|
4228
4364
|
|
4229
4365
|
|
@@ -4231,7 +4367,8 @@ multiple locales.</p>
|
|
4231
4367
|
|
4232
4368
|
</h3><div class="docstring">
|
4233
4369
|
<div class="discussion">
|
4234
|
-
<p>Returns
|
4370
|
+
<p>Returns The content’s title. Can be a <code>String</code> or an <code>HashWithIndifferentAccess</code>, if multiple titles are specified for
|
4371
|
+
multiple locales.</p>
|
4235
4372
|
|
4236
4373
|
|
4237
4374
|
</div>
|
@@ -4244,12 +4381,13 @@ multiple locales.</p>
|
|
4244
4381
|
<li>
|
4245
4382
|
|
4246
4383
|
|
4247
|
-
<span class='type'>(<tt>String</tt>)</span>
|
4384
|
+
<span class='type'>(<tt>String|HashWithIndifferentAccess</tt>)</span>
|
4248
4385
|
|
4249
4386
|
|
4250
4387
|
|
4251
4388
|
—
|
4252
|
-
<div class='inline'><p>
|
4389
|
+
<div class='inline'><p>The content’s title. Can be a <code>String</code> or an <code>HashWithIndifferentAccess</code>, if multiple titles are specified for
|
4390
|
+
multiple locales.</p>
|
4253
4391
|
</div>
|
4254
4392
|
|
4255
4393
|
</li>
|
@@ -4262,8 +4400,6 @@ multiple locales.</p>
|
|
4262
4400
|
<pre class="lines">
|
4263
4401
|
|
4264
4402
|
|
4265
|
-
117
|
4266
|
-
118
|
4267
4403
|
119
|
4268
4404
|
120
|
4269
4405
|
121
|
@@ -4491,10 +4627,20 @@ multiple locales.</p>
|
|
4491
4627
|
343
|
4492
4628
|
344
|
4493
4629
|
345
|
4494
|
-
346
|
4630
|
+
346
|
4631
|
+
347
|
4632
|
+
348
|
4633
|
+
349
|
4634
|
+
350
|
4635
|
+
351
|
4636
|
+
352
|
4637
|
+
353
|
4638
|
+
354
|
4639
|
+
355
|
4640
|
+
356</pre>
|
4495
4641
|
</td>
|
4496
4642
|
<td>
|
4497
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
4643
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
4498
4644
|
|
4499
4645
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
4500
4646
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -4502,6 +4648,7 @@ multiple locales.</p>
|
|
4502
4648
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
4503
4649
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
4504
4650
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
4651
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
4505
4652
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
4506
4653
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
4507
4654
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -4532,6 +4679,14 @@ multiple locales.</p>
|
|
4532
4679
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
4533
4680
|
<span class='kw'>end</span>
|
4534
4681
|
|
4682
|
+
<span class='comment'># Sets the `summary` attribute.
|
4683
|
+
</span> <span class='comment'>#
|
4684
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
4685
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
4686
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
4687
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
4688
|
+
<span class='kw'>end</span>
|
4689
|
+
|
4535
4690
|
<span class='comment'># Sets the `body` attribute.
|
4536
4691
|
</span> <span class='comment'>#
|
4537
4692
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -4592,7 +4747,7 @@ multiple locales.</p>
|
|
4592
4747
|
</span> <span class='comment'>#
|
4593
4748
|
</span> <span class='comment'># @return The metadata attribute.
|
4594
4749
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
4595
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
4750
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
4596
4751
|
<span class='kw'>end</span>
|
4597
4752
|
|
4598
4753
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -4615,7 +4770,7 @@ multiple locales.</p>
|
|
4615
4770
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
4616
4771
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
4617
4772
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
4618
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
4773
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
4619
4774
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
4620
4775
|
<span class='kw'>end</span>
|
4621
4776
|
|
@@ -4640,7 +4795,7 @@ multiple locales.</p>
|
|
4640
4795
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
4641
4796
|
<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>
|
4642
4797
|
<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>
|
4643
|
-
<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='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>
|
4798
|
+
<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>
|
4644
4799
|
<span class='id identifier rubyid_rv'>rv</span>
|
4645
4800
|
<span class='kw'>end</span>
|
4646
4801
|
|
@@ -4651,10 +4806,9 @@ multiple locales.</p>
|
|
4651
4806
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
4652
4807
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
4653
4808
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
4654
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
4655
|
-
|
4656
4809
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
4657
4810
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
4811
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
4658
4812
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
4659
4813
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
4660
4814
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -4732,11 +4886,11 @@ multiple locales.</p>
|
|
4732
4886
|
</div>
|
4733
4887
|
|
4734
4888
|
|
4735
|
-
<span id="
|
4889
|
+
<span id="uid=-instance_method"></span>
|
4736
4890
|
<div class="method_details ">
|
4737
|
-
<h3 class="signature " id="
|
4891
|
+
<h3 class="signature " id="uid-instance_method">
|
4738
4892
|
|
4739
|
-
- (<tt>
|
4893
|
+
- (<tt>String</tt>) <strong>uid</strong>
|
4740
4894
|
|
4741
4895
|
|
4742
4896
|
|
@@ -4744,7 +4898,7 @@ multiple locales.</p>
|
|
4744
4898
|
|
4745
4899
|
</h3><div class="docstring">
|
4746
4900
|
<div class="discussion">
|
4747
|
-
<p>Returns
|
4901
|
+
<p>Returns A unique ID for this post. This is only for client uses.</p>
|
4748
4902
|
|
4749
4903
|
|
4750
4904
|
</div>
|
@@ -4757,12 +4911,12 @@ multiple locales.</p>
|
|
4757
4911
|
<li>
|
4758
4912
|
|
4759
4913
|
|
4760
|
-
<span class='type'>(<tt>
|
4914
|
+
<span class='type'>(<tt>String</tt>)</span>
|
4761
4915
|
|
4762
4916
|
|
4763
4917
|
|
4764
4918
|
—
|
4765
|
-
<div class='inline'><p>
|
4919
|
+
<div class='inline'><p>A unique ID for this post. This is only for client uses.</p>
|
4766
4920
|
</div>
|
4767
4921
|
|
4768
4922
|
</li>
|
@@ -4775,8 +4929,6 @@ multiple locales.</p>
|
|
4775
4929
|
<pre class="lines">
|
4776
4930
|
|
4777
4931
|
|
4778
|
-
117
|
4779
|
-
118
|
4780
4932
|
119
|
4781
4933
|
120
|
4782
4934
|
121
|
@@ -5004,10 +5156,20 @@ multiple locales.</p>
|
|
5004
5156
|
343
|
5005
5157
|
344
|
5006
5158
|
345
|
5007
|
-
346
|
5159
|
+
346
|
5160
|
+
347
|
5161
|
+
348
|
5162
|
+
349
|
5163
|
+
350
|
5164
|
+
351
|
5165
|
+
352
|
5166
|
+
353
|
5167
|
+
354
|
5168
|
+
355
|
5169
|
+
356</pre>
|
5008
5170
|
</td>
|
5009
5171
|
<td>
|
5010
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
5172
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
5011
5173
|
|
5012
5174
|
<span class='kw'>class</span> <span class='const'>Content</span>
|
5013
5175
|
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
@@ -5015,6 +5177,7 @@ multiple locales.</p>
|
|
5015
5177
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
5016
5178
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
5017
5179
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
5180
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
5018
5181
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
5019
5182
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
5020
5183
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
@@ -5045,6 +5208,14 @@ multiple locales.</p>
|
|
5045
5208
|
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5046
5209
|
<span class='kw'>end</span>
|
5047
5210
|
|
5211
|
+
<span class='comment'># Sets the `summary` attribute.
|
5212
|
+
</span> <span class='comment'>#
|
5213
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
5214
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
5215
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
5216
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5217
|
+
<span class='kw'>end</span>
|
5218
|
+
|
5048
5219
|
<span class='comment'># Sets the `body` attribute.
|
5049
5220
|
</span> <span class='comment'>#
|
5050
5221
|
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
@@ -5105,7 +5276,7 @@ multiple locales.</p>
|
|
5105
5276
|
</span> <span class='comment'>#
|
5106
5277
|
</span> <span class='comment'># @return The metadata attribute.
|
5107
5278
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
5108
|
-
<span class='ivar'>@metadata</span> <span class='op'
|
5279
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
5109
5280
|
<span class='kw'>end</span>
|
5110
5281
|
|
5111
5282
|
<span class='comment'># Sets the `metadata` attribute.
|
@@ -5128,7 +5299,7 @@ multiple locales.</p>
|
|
5128
5299
|
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
5129
5300
|
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
5130
5301
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
5131
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
5302
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
5132
5303
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
5133
5304
|
<span class='kw'>end</span>
|
5134
5305
|
|
@@ -5153,7 +5324,7 @@ multiple locales.</p>
|
|
5153
5324
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
5154
5325
|
<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>
|
5155
5326
|
<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>
|
5156
|
-
<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='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>
|
5327
|
+
<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>
|
5157
5328
|
<span class='id identifier rubyid_rv'>rv</span>
|
5158
5329
|
<span class='kw'>end</span>
|
5159
5330
|
|
@@ -5164,10 +5335,9 @@ multiple locales.</p>
|
|
5164
5335
|
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
5165
5336
|
</span> <span class='comment'># @return [Content] The content with metadata.
|
5166
5337
|
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
5167
|
-
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
|
5168
|
-
|
5169
5338
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
5170
5339
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
5340
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
5171
5341
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
5172
5342
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
5173
5343
|
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
@@ -5244,17 +5414,12 @@ multiple locales.</p>
|
|
5244
5414
|
</table>
|
5245
5415
|
</div>
|
5246
5416
|
|
5247
|
-
|
5248
|
-
|
5249
|
-
|
5250
|
-
<
|
5251
|
-
<h2>Class Method Details</h2>
|
5252
|
-
|
5253
|
-
|
5254
|
-
<div class="method_details first">
|
5255
|
-
<h3 class="signature first" id="create-class_method">
|
5417
|
+
|
5418
|
+
<span id="updated_at=-instance_method"></span>
|
5419
|
+
<div class="method_details ">
|
5420
|
+
<h3 class="signature " id="updated_at-instance_method">
|
5256
5421
|
|
5257
|
-
|
5422
|
+
- (<tt>DateTime</tt>) <strong>updated_at</strong>
|
5258
5423
|
|
5259
5424
|
|
5260
5425
|
|
@@ -5262,59 +5427,25 @@ multiple locales.</p>
|
|
5262
5427
|
|
5263
5428
|
</h3><div class="docstring">
|
5264
5429
|
<div class="discussion">
|
5265
|
-
<p>
|
5430
|
+
<p>Returns The post creation date and time. Defaults to the creation date. The timezone is always UTC.</p>
|
5266
5431
|
|
5267
5432
|
|
5268
5433
|
</div>
|
5269
5434
|
</div>
|
5270
5435
|
<div class="tags">
|
5271
|
-
<p class="tag_title">Parameters:</p>
|
5272
|
-
<ul class="param">
|
5273
|
-
|
5274
|
-
<li>
|
5275
|
-
|
5276
|
-
<span class='name'>metadata</span>
|
5277
|
-
|
5278
|
-
|
5279
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
5280
|
-
|
5281
|
-
|
5282
|
-
|
5283
|
-
—
|
5284
|
-
<div class='inline'><p>The metadata.</p>
|
5285
|
-
</div>
|
5286
|
-
|
5287
|
-
</li>
|
5288
|
-
|
5289
|
-
<li>
|
5290
|
-
|
5291
|
-
<span class='name'>body</span>
|
5292
|
-
|
5293
|
-
|
5294
|
-
<span class='type'>(<tt>String</tt>)</span>
|
5295
|
-
|
5296
|
-
|
5297
|
-
|
5298
|
-
—
|
5299
|
-
<div class='inline'><p>The body of the content.</p>
|
5300
|
-
</div>
|
5301
|
-
|
5302
|
-
</li>
|
5303
5436
|
|
5304
|
-
</ul>
|
5305
|
-
|
5306
5437
|
<p class="tag_title">Returns:</p>
|
5307
5438
|
<ul class="return">
|
5308
5439
|
|
5309
5440
|
<li>
|
5310
5441
|
|
5311
5442
|
|
5312
|
-
<span class='type'>(<tt
|
5443
|
+
<span class='type'>(<tt>DateTime</tt>)</span>
|
5313
5444
|
|
5314
5445
|
|
5315
5446
|
|
5316
5447
|
—
|
5317
|
-
<div class='inline'><p>
|
5448
|
+
<div class='inline'><p>The post creation date and time. Defaults to the creation date. The timezone is always UTC.</p>
|
5318
5449
|
</div>
|
5319
5450
|
|
5320
5451
|
</li>
|
@@ -5327,80 +5458,648 @@ multiple locales.</p>
|
|
5327
5458
|
<pre class="lines">
|
5328
5459
|
|
5329
5460
|
|
5330
|
-
|
5331
|
-
|
5332
|
-
|
5333
|
-
|
5334
|
-
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5338
|
-
|
5339
|
-
|
5340
|
-
|
5341
|
-
|
5342
|
-
|
5343
|
-
|
5344
|
-
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5351
|
-
|
5352
|
-
|
5353
|
-
|
5354
|
-
|
5355
|
-
|
5356
|
-
|
5357
|
-
|
5358
|
-
|
5359
|
-
|
5360
|
-
|
5361
|
-
|
5362
|
-
|
5363
|
-
|
5364
|
-
|
5365
|
-
|
5366
|
-
|
5367
|
-
|
5368
|
-
|
5369
|
-
|
5370
|
-
|
5371
|
-
|
5372
|
-
|
5373
|
-
|
5374
|
-
|
5375
|
-
|
5376
|
-
|
5377
|
-
|
5378
|
-
|
5379
|
-
|
5380
|
-
|
5381
|
-
|
5382
|
-
|
5383
|
-
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5387
|
-
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5391
|
-
|
5392
|
-
|
5393
|
-
|
5394
|
-
|
5395
|
-
|
5396
|
-
|
5397
|
-
|
5398
|
-
|
5399
|
-
|
5400
|
-
|
5401
|
-
|
5402
|
-
|
5403
|
-
|
5461
|
+
119
|
5462
|
+
120
|
5463
|
+
121
|
5464
|
+
122
|
5465
|
+
123
|
5466
|
+
124
|
5467
|
+
125
|
5468
|
+
126
|
5469
|
+
127
|
5470
|
+
128
|
5471
|
+
129
|
5472
|
+
130
|
5473
|
+
131
|
5474
|
+
132
|
5475
|
+
133
|
5476
|
+
134
|
5477
|
+
135
|
5478
|
+
136
|
5479
|
+
137
|
5480
|
+
138
|
5481
|
+
139
|
5482
|
+
140
|
5483
|
+
141
|
5484
|
+
142
|
5485
|
+
143
|
5486
|
+
144
|
5487
|
+
145
|
5488
|
+
146
|
5489
|
+
147
|
5490
|
+
148
|
5491
|
+
149
|
5492
|
+
150
|
5493
|
+
151
|
5494
|
+
152
|
5495
|
+
153
|
5496
|
+
154
|
5497
|
+
155
|
5498
|
+
156
|
5499
|
+
157
|
5500
|
+
158
|
5501
|
+
159
|
5502
|
+
160
|
5503
|
+
161
|
5504
|
+
162
|
5505
|
+
163
|
5506
|
+
164
|
5507
|
+
165
|
5508
|
+
166
|
5509
|
+
167
|
5510
|
+
168
|
5511
|
+
169
|
5512
|
+
170
|
5513
|
+
171
|
5514
|
+
172
|
5515
|
+
173
|
5516
|
+
174
|
5517
|
+
175
|
5518
|
+
176
|
5519
|
+
177
|
5520
|
+
178
|
5521
|
+
179
|
5522
|
+
180
|
5523
|
+
181
|
5524
|
+
182
|
5525
|
+
183
|
5526
|
+
184
|
5527
|
+
185
|
5528
|
+
186
|
5529
|
+
187
|
5530
|
+
188
|
5531
|
+
189
|
5532
|
+
190
|
5533
|
+
191
|
5534
|
+
192
|
5535
|
+
193
|
5536
|
+
194
|
5537
|
+
195
|
5538
|
+
196
|
5539
|
+
197
|
5540
|
+
198
|
5541
|
+
199
|
5542
|
+
200
|
5543
|
+
201
|
5544
|
+
202
|
5545
|
+
203
|
5546
|
+
204
|
5547
|
+
205
|
5548
|
+
206
|
5549
|
+
207
|
5550
|
+
208
|
5551
|
+
209
|
5552
|
+
210
|
5553
|
+
211
|
5554
|
+
212
|
5555
|
+
213
|
5556
|
+
214
|
5557
|
+
215
|
5558
|
+
216
|
5559
|
+
217
|
5560
|
+
218
|
5561
|
+
219
|
5562
|
+
220
|
5563
|
+
221
|
5564
|
+
222
|
5565
|
+
223
|
5566
|
+
224
|
5567
|
+
225
|
5568
|
+
226
|
5569
|
+
227
|
5570
|
+
228
|
5571
|
+
229
|
5572
|
+
230
|
5573
|
+
231
|
5574
|
+
232
|
5575
|
+
233
|
5576
|
+
234
|
5577
|
+
235
|
5578
|
+
236
|
5579
|
+
237
|
5580
|
+
238
|
5581
|
+
239
|
5582
|
+
240
|
5583
|
+
241
|
5584
|
+
242
|
5585
|
+
243
|
5586
|
+
244
|
5587
|
+
245
|
5588
|
+
246
|
5589
|
+
247
|
5590
|
+
248
|
5591
|
+
249
|
5592
|
+
250
|
5593
|
+
251
|
5594
|
+
252
|
5595
|
+
253
|
5596
|
+
254
|
5597
|
+
255
|
5598
|
+
256
|
5599
|
+
257
|
5600
|
+
258
|
5601
|
+
259
|
5602
|
+
260
|
5603
|
+
261
|
5604
|
+
262
|
5605
|
+
263
|
5606
|
+
264
|
5607
|
+
265
|
5608
|
+
266
|
5609
|
+
267
|
5610
|
+
268
|
5611
|
+
269
|
5612
|
+
270
|
5613
|
+
271
|
5614
|
+
272
|
5615
|
+
273
|
5616
|
+
274
|
5617
|
+
275
|
5618
|
+
276
|
5619
|
+
277
|
5620
|
+
278
|
5621
|
+
279
|
5622
|
+
280
|
5623
|
+
281
|
5624
|
+
282
|
5625
|
+
283
|
5626
|
+
284
|
5627
|
+
285
|
5628
|
+
286
|
5629
|
+
287
|
5630
|
+
288
|
5631
|
+
289
|
5632
|
+
290
|
5633
|
+
291
|
5634
|
+
292
|
5635
|
+
293
|
5636
|
+
294
|
5637
|
+
295
|
5638
|
+
296
|
5639
|
+
297
|
5640
|
+
298
|
5641
|
+
299
|
5642
|
+
300
|
5643
|
+
301
|
5644
|
+
302
|
5645
|
+
303
|
5646
|
+
304
|
5647
|
+
305
|
5648
|
+
306
|
5649
|
+
307
|
5650
|
+
308
|
5651
|
+
309
|
5652
|
+
310
|
5653
|
+
311
|
5654
|
+
312
|
5655
|
+
313
|
5656
|
+
314
|
5657
|
+
315
|
5658
|
+
316
|
5659
|
+
317
|
5660
|
+
318
|
5661
|
+
319
|
5662
|
+
320
|
5663
|
+
321
|
5664
|
+
322
|
5665
|
+
323
|
5666
|
+
324
|
5667
|
+
325
|
5668
|
+
326
|
5669
|
+
327
|
5670
|
+
328
|
5671
|
+
329
|
5672
|
+
330
|
5673
|
+
331
|
5674
|
+
332
|
5675
|
+
333
|
5676
|
+
334
|
5677
|
+
335
|
5678
|
+
336
|
5679
|
+
337
|
5680
|
+
338
|
5681
|
+
339
|
5682
|
+
340
|
5683
|
+
341
|
5684
|
+
342
|
5685
|
+
343
|
5686
|
+
344
|
5687
|
+
345
|
5688
|
+
346
|
5689
|
+
347
|
5690
|
+
348
|
5691
|
+
349
|
5692
|
+
350
|
5693
|
+
351
|
5694
|
+
352
|
5695
|
+
353
|
5696
|
+
354
|
5697
|
+
355
|
5698
|
+
356</pre>
|
5699
|
+
</td>
|
5700
|
+
<td>
|
5701
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 119</span>
|
5702
|
+
|
5703
|
+
<span class='kw'>class</span> <span class='const'>Content</span>
|
5704
|
+
<span class='id identifier rubyid_include'>include</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>ContentPublicInterface</span>
|
5705
|
+
|
5706
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
5707
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:locales</span>
|
5708
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:title</span>
|
5709
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:summary</span>
|
5710
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:body</span>
|
5711
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tags</span>
|
5712
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:more</span>
|
5713
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:author</span>
|
5714
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:created_at</span>
|
5715
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:updated_at</span>
|
5716
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
5717
|
+
|
5718
|
+
<span class='comment'># Creates a new content.
|
5719
|
+
</span> <span class='comment'>#
|
5720
|
+
</span> <span class='comment'># @param uid [String] The UID for this content.
|
5721
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
5722
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
5723
|
+
<span class='kw'>end</span>
|
5724
|
+
|
5725
|
+
<span class='comment'># Sets the `locales` attribute.
|
5726
|
+
</span> <span class='comment'>#
|
5727
|
+
</span> <span class='comment'># @param value [Array] The new value for the attribute. A empty or "*" will be the default value.
|
5728
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_locales='>locales=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5729
|
+
<span class='ivar'>@locales</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</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>
|
5730
|
+
<span class='kw'>end</span>
|
5731
|
+
|
5732
|
+
<span class='comment'># Sets the `title` attribute.
|
5733
|
+
</span> <span class='comment'>#
|
5734
|
+
</span> <span class='comment'># @param new_title [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
5735
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
5736
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_title='>title=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span>
|
5737
|
+
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_title'>new_title</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_title'>new_title</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5738
|
+
<span class='kw'>end</span>
|
5739
|
+
|
5740
|
+
<span class='comment'># Sets the `summary` attribute.
|
5741
|
+
</span> <span class='comment'>#
|
5742
|
+
</span> <span class='comment'># @param new_summary [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
5743
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
5744
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_summary='>summary=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span>
|
5745
|
+
<span class='ivar'>@summary</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_summary'>new_summary</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_summary'>new_summary</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5746
|
+
<span class='kw'>end</span>
|
5747
|
+
|
5748
|
+
<span class='comment'># Sets the `body` attribute.
|
5749
|
+
</span> <span class='comment'>#
|
5750
|
+
</span> <span class='comment'># @param value [String] The new value for the attribute. Can contain locales restriction (like !en), which will must be interpreted using #get_body.
|
5751
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_body='>body=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5752
|
+
<span class='ivar'>@body</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5753
|
+
<span class='kw'>end</span>
|
5754
|
+
|
5755
|
+
<span class='comment'># Sets the `tags` attribute.
|
5756
|
+
</span> <span class='comment'>#
|
5757
|
+
</span> <span class='comment'># @param new_tags [Array|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
5758
|
+
</span> <span class='comment'># A empty or "*" will be the default value. Tags can also be comma-separated.
|
5759
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_tags='>tags=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_tags'>new_tags</span><span class='rparen'>)</span>
|
5760
|
+
<span class='ivar'>@tags</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_tags'>new_tags</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
5761
|
+
<span class='id identifier rubyid_new_tags'>new_tags</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_parse_tags'>parse_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
5762
|
+
<span class='kw'>else</span>
|
5763
|
+
<span class='id identifier rubyid_parse_tags'>parse_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_new_tags'>new_tags</span><span class='rparen'>)</span>
|
5764
|
+
<span class='kw'>end</span>
|
5765
|
+
<span class='kw'>end</span>
|
5766
|
+
|
5767
|
+
<span class='comment'># Sets the `more` attribute.
|
5768
|
+
</span> <span class='comment'>#
|
5769
|
+
</span> <span class='comment'># @param new_more [String|Hash] The new value for the attribute. If an Hash, keys must be a string with one or locale separated by commas.
|
5770
|
+
</span> <span class='comment'># A empty or "*" will be the default value.
|
5771
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_more='>more=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_more'>new_more</span><span class='rparen'>)</span>
|
5772
|
+
<span class='ivar'>@more</span> <span class='op'>=</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_more'>new_more</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_new_more'>new_more</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_new_more'>new_more</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
5773
|
+
<span class='kw'>end</span>
|
5774
|
+
|
5775
|
+
<span class='comment'># Sets the `author` attribute.
|
5776
|
+
</span> <span class='comment'>#
|
5777
|
+
</span> <span class='comment'># @param new_author [Author|Hash|Object|NilClass] The new value for the attribute.
|
5778
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_author='>author=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_author'>new_author</span><span class='rparen'>)</span>
|
5779
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_new_author'>new_author</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
5780
|
+
<span class='ivar'>@author</span> <span class='op'>=</span> <span class='id identifier rubyid_new_author'>new_author</span>
|
5781
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_author'>new_author</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
5782
|
+
<span class='id identifier rubyid_new_author'>new_author</span> <span class='op'>=</span> <span class='id identifier rubyid_new_author'>new_author</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='rparen'>)</span>
|
5783
|
+
<span class='ivar'>@author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_new_author'>new_author</span><span class='rparen'>)</span>
|
5784
|
+
<span class='kw'>else</span>
|
5785
|
+
<span class='ivar'>@author</span> <span class='op'>=</span> <span class='id identifier rubyid_new_author'>new_author</span> <span class='op'>?</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_new_author'>new_author</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
5786
|
+
<span class='kw'>end</span>
|
5787
|
+
<span class='kw'>end</span>
|
5788
|
+
|
5789
|
+
<span class='comment'># Sets the `created_at` attribute.
|
5790
|
+
</span> <span class='comment'>#
|
5791
|
+
</span> <span class='comment'># @param value [String|DateTime|Fixnum] The new value for the attribute.
|
5792
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_created_at='>created_at=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5793
|
+
<span class='ivar'>@created_at</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_datetime'>extract_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5794
|
+
<span class='kw'>end</span>
|
5795
|
+
|
5796
|
+
<span class='comment'># Sets the `updated_at` attribute.
|
5797
|
+
</span> <span class='comment'>#
|
5798
|
+
</span> <span class='comment'># @param value [String|DateTime|Fixnum] The new value for the attribute.
|
5799
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_updated_at='>updated_at=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5800
|
+
<span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_datetime'>extract_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5801
|
+
<span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='ivar'>@created_at</span> <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@updated_at</span>
|
5802
|
+
<span class='kw'>end</span>
|
5803
|
+
|
5804
|
+
<span class='comment'># Gets metadata attribute.
|
5805
|
+
</span> <span class='comment'>#
|
5806
|
+
</span> <span class='comment'># @return The metadata attribute.
|
5807
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
5808
|
+
<span class='ivar'>@metadata</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
5809
|
+
<span class='kw'>end</span>
|
5810
|
+
|
5811
|
+
<span class='comment'># Sets the `metadata` attribute.
|
5812
|
+
</span> <span class='comment'>#
|
5813
|
+
</span> <span class='comment'># @param new_metadata [Hash] The new value for the attribute.
|
5814
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_metadata='>metadata=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_metadata'>new_metadata</span><span class='rparen'>)</span>
|
5815
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_new_metadata'>new_metadata</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
5816
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_new_metadata'>new_metadata</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='rparen'>)</span>
|
5817
|
+
<span class='kw'>else</span>
|
5818
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>raw:</span> <span class='id identifier rubyid_new_metadata'>new_metadata</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
5819
|
+
<span class='kw'>end</span>
|
5820
|
+
<span class='kw'>end</span>
|
5821
|
+
|
5822
|
+
<span class='comment'># Returns the content as an Hash.
|
5823
|
+
</span> <span class='comment'>#
|
5824
|
+
</span> <span class='comment'># @param options [Hash] Options to modify behavior of the serialization.
|
5825
|
+
</span> <span class='comment'># The only supported value are:
|
5826
|
+
</span> <span class='comment'>#
|
5827
|
+
</span> <span class='comment'># * `:exclude`, an array of attributes to skip.
|
5828
|
+
</span> <span class='comment'># * `:exclude_empty`, if to exclude nil values. Default is `false`.
|
5829
|
+
</span> <span class='comment'># @return [Hash] An hash with all attributes.
|
5830
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
5831
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
5832
|
+
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
5833
|
+
<span class='kw'>end</span>
|
5834
|
+
|
5835
|
+
<span class='comment'># Validates locales for attribute retrieval.
|
5836
|
+
</span> <span class='comment'>#
|
5837
|
+
</span> <span class='comment'># @param locales [Array] A list of desired locales for an attribute. Can include `*` to match all. If none are specified, the default mbrao locale will be
|
5838
|
+
</span> <span class='comment'># used.
|
5839
|
+
</span> <span class='comment'># @param content [Content|nil] An optional content to check for availability
|
5840
|
+
</span> <span class='comment'># @return [Array] The validated list of locales.
|
5841
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
5842
|
+
<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>
|
5843
|
+
<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>
|
5844
|
+
<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='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_content'>content</span> <span class='op'>&&</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>
|
5845
|
+
<span class='id identifier rubyid_locales'>locales</span>
|
5846
|
+
<span class='kw'>end</span>
|
5847
|
+
|
5848
|
+
<span class='comment'># Creates a content with metadata and body.
|
5849
|
+
</span> <span class='comment'>#
|
5850
|
+
</span> <span class='comment'># @param metadata [Hash] The metadata.
|
5851
|
+
</span> <span class='comment'># @param body [String] The body of the content.
|
5852
|
+
</span> <span class='comment'># @return [Content] A new content.
|
5853
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
5854
|
+
<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>
|
5855
|
+
<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>
|
5856
|
+
<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>
|
5857
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
5858
|
+
<span class='kw'>end</span>
|
5859
|
+
|
5860
|
+
<span class='id identifier rubyid_private'>private</span>
|
5861
|
+
<span class='comment'># Assigns metadata to a content
|
5862
|
+
</span> <span class='comment'>#
|
5863
|
+
</span> <span class='comment'># @param content [Content] The content to manipulate.
|
5864
|
+
</span> <span class='comment'># @param metadata [Hash] The metadata to assign.
|
5865
|
+
</span> <span class='comment'># @return [Content] The content with metadata.
|
5866
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_assign_metadata'>assign_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
5867
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:uid</span><span class='rparen'>)</span>
|
5868
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_title'>title</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:title</span><span class='rparen'>)</span>
|
5869
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_summary'>summary</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:summary</span><span class='rparen'>)</span>
|
5870
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_author'>author</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Author</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:author</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
5871
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:tags</span><span class='rparen'>)</span>
|
5872
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_more'>more</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:more</span><span class='rparen'>)</span>
|
5873
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_created_at'>created_at</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:created_at</span><span class='rparen'>)</span>
|
5874
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:updated_at</span><span class='rparen'>)</span>
|
5875
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_locales'>extract_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
5876
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
5877
|
+
|
5878
|
+
<span class='id identifier rubyid_content'>content</span>
|
5879
|
+
<span class='kw'>end</span>
|
5880
|
+
|
5881
|
+
<span class='comment'># Extract locales from metadata.
|
5882
|
+
</span> <span class='comment'>#
|
5883
|
+
</span> <span class='comment'># @param metadata [Hash] The metadata that contains the locales.
|
5884
|
+
</span> <span class='comment'># @return [Array] The locales.
|
5885
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_extract_locales'>extract_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
5886
|
+
<span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:locales</span><span class='rparen'>)</span>
|
5887
|
+
<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_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s*,\s*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Array</span><span class='rparen'>)</span>
|
5888
|
+
<span class='id identifier rubyid_normalize_locales'>normalize_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
|
5889
|
+
<span class='kw'>end</span>
|
5890
|
+
|
5891
|
+
<span class='comment'># Normalize locales for further usage.
|
5892
|
+
</span> <span class='comment'>#
|
5893
|
+
</span> <span class='comment'># @param locales [Array] The locales to normalize.
|
5894
|
+
</span> <span class='comment'># @return [Array] The normalized locales.
|
5895
|
+
</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_locales'>normalize_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
|
5896
|
+
<span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:ensure_string</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:strip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span>
|
5897
|
+
<span class='kw'>end</span>
|
5898
|
+
|
5899
|
+
<span class='comment'># Extracts a date and time from a value.
|
5900
|
+
</span> <span class='comment'>#
|
5901
|
+
</span> <span class='comment'># @param value [String|DateTime|Fixnum] The value to parse.
|
5902
|
+
</span> <span class='comment'># @return [DateTime] The extracted value.
|
5903
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_datetime'>extract_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5904
|
+
<span class='kw'>begin</span>
|
5905
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_datetime'>parse_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span>
|
5906
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>?</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
5907
|
+
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
|
5908
|
+
<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'>InvalidDate</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
5909
|
+
<span class='kw'>end</span>
|
5910
|
+
<span class='kw'>end</span>
|
5911
|
+
|
5912
|
+
<span class='comment'># Parse a datetime
|
5913
|
+
</span> <span class='comment'># @param value [String|DateTime|Fixnum] The value to parse.
|
5914
|
+
</span> <span class='comment'># @return [DateTime] The extracted value.
|
5915
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_parse_datetime'>parse_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5916
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_value'>value</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>
|
5917
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>DateTime</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_value'>value</span>
|
5918
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Date</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Time</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_datetime'>to_datetime</span>
|
5919
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Float</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Fixnum</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span>
|
5920
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_float'>to_float</span> <span class='op'>></span> <span class='int'>0</span> <span class='op'>?</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_float'>to_float</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_datetime'>to_datetime</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
5921
|
+
<span class='kw'>else</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_strptime'>strptime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%Y%m%dT%H%M%S%z</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
5922
|
+
<span class='kw'>end</span>
|
5923
|
+
<span class='kw'>end</span>
|
5924
|
+
|
5925
|
+
<span class='comment'># Extract tags from an array, making sure all the comma separated strings are evaluated.
|
5926
|
+
</span> <span class='comment'>#
|
5927
|
+
</span> <span class='comment'># @param value [String|Array] The string or array to parse.
|
5928
|
+
</span> <span class='comment'># @return [Array] The list of tags.
|
5929
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_parse_tags'>parse_tags</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5930
|
+
<span class='id identifier rubyid_value'>value</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_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s*,\s*</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
5931
|
+
<span class='kw'>end</span>
|
5932
|
+
|
5933
|
+
<span class='comment'># Check if value is an Hash.
|
5934
|
+
</span> <span class='comment'>#
|
5935
|
+
</span> <span class='comment'># @param value [Object] The object to check.
|
5936
|
+
</span> <span class='comment'># @return [Boolean] `true` if value is an Hash, `false` otherwise
|
5937
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_is_hash?'>is_hash?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
5938
|
+
<span class='id identifier rubyid_value'>value</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>
|
5939
|
+
<span class='kw'>end</span>
|
5940
|
+
<span class='kw'>end</span></pre>
|
5941
|
+
</td>
|
5942
|
+
</tr>
|
5943
|
+
</table>
|
5944
|
+
</div>
|
5945
|
+
|
5946
|
+
</div>
|
5947
|
+
|
5948
|
+
|
5949
|
+
<div id="class_method_details" class="method_details_list">
|
5950
|
+
<h2>Class Method Details</h2>
|
5951
|
+
|
5952
|
+
|
5953
|
+
<div class="method_details first">
|
5954
|
+
<h3 class="signature first" id="create-class_method">
|
5955
|
+
|
5956
|
+
+ (<tt><span class='object_link'><a href="" title="Mbrao::Content (class)">Content</a></span></tt>) <strong>create</strong>(metadata, body)
|
5957
|
+
|
5958
|
+
|
5959
|
+
|
5960
|
+
|
5961
|
+
|
5962
|
+
</h3><div class="docstring">
|
5963
|
+
<div class="discussion">
|
5964
|
+
<p>Creates a content with metadata and body.</p>
|
5965
|
+
|
5966
|
+
|
5967
|
+
</div>
|
5968
|
+
</div>
|
5969
|
+
<div class="tags">
|
5970
|
+
<p class="tag_title">Parameters:</p>
|
5971
|
+
<ul class="param">
|
5972
|
+
|
5973
|
+
<li>
|
5974
|
+
|
5975
|
+
<span class='name'>metadata</span>
|
5976
|
+
|
5977
|
+
|
5978
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
5979
|
+
|
5980
|
+
|
5981
|
+
|
5982
|
+
—
|
5983
|
+
<div class='inline'><p>The metadata.</p>
|
5984
|
+
</div>
|
5985
|
+
|
5986
|
+
</li>
|
5987
|
+
|
5988
|
+
<li>
|
5989
|
+
|
5990
|
+
<span class='name'>body</span>
|
5991
|
+
|
5992
|
+
|
5993
|
+
<span class='type'>(<tt>String</tt>)</span>
|
5994
|
+
|
5995
|
+
|
5996
|
+
|
5997
|
+
—
|
5998
|
+
<div class='inline'><p>The body of the content.</p>
|
5999
|
+
</div>
|
6000
|
+
|
6001
|
+
</li>
|
6002
|
+
|
6003
|
+
</ul>
|
6004
|
+
|
6005
|
+
<p class="tag_title">Returns:</p>
|
6006
|
+
<ul class="return">
|
6007
|
+
|
6008
|
+
<li>
|
6009
|
+
|
6010
|
+
|
6011
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Mbrao::Content (class)">Content</a></span></tt>)</span>
|
6012
|
+
|
6013
|
+
|
6014
|
+
|
6015
|
+
—
|
6016
|
+
<div class='inline'><p>A new content.</p>
|
6017
|
+
</div>
|
6018
|
+
|
6019
|
+
</li>
|
6020
|
+
|
6021
|
+
</ul>
|
6022
|
+
|
6023
|
+
</div><table class="source_code">
|
6024
|
+
<tr>
|
6025
|
+
<td>
|
6026
|
+
<pre class="lines">
|
6027
|
+
|
6028
|
+
|
6029
|
+
269
|
6030
|
+
270
|
6031
|
+
271
|
6032
|
+
272
|
6033
|
+
273
|
6034
|
+
274</pre>
|
6035
|
+
</td>
|
6036
|
+
<td>
|
6037
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 269</span>
|
6038
|
+
|
6039
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
6040
|
+
<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>
|
6041
|
+
<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>
|
6042
|
+
<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>
|
6043
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
6044
|
+
<span class='kw'>end</span></pre>
|
6045
|
+
</td>
|
6046
|
+
</tr>
|
6047
|
+
</table>
|
6048
|
+
</div>
|
6049
|
+
|
6050
|
+
<div class="method_details ">
|
6051
|
+
<h3 class="signature " id="validate_locales-class_method">
|
6052
|
+
|
6053
|
+
+ (<tt>Array</tt>) <strong>validate_locales</strong>(locales, content = nil)
|
6054
|
+
|
6055
|
+
|
6056
|
+
|
6057
|
+
|
6058
|
+
|
6059
|
+
</h3><div class="docstring">
|
6060
|
+
<div class="discussion">
|
6061
|
+
<p>Validates locales for attribute retrieval.</p>
|
6062
|
+
|
6063
|
+
|
6064
|
+
</div>
|
6065
|
+
</div>
|
6066
|
+
<div class="tags">
|
6067
|
+
<p class="tag_title">Parameters:</p>
|
6068
|
+
<ul class="param">
|
6069
|
+
|
6070
|
+
<li>
|
6071
|
+
|
6072
|
+
<span class='name'>locales</span>
|
6073
|
+
|
6074
|
+
|
6075
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
6076
|
+
|
6077
|
+
|
6078
|
+
|
6079
|
+
—
|
6080
|
+
<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
|
6081
|
+
used.</p>
|
6082
|
+
</div>
|
6083
|
+
|
6084
|
+
</li>
|
6085
|
+
|
6086
|
+
<li>
|
6087
|
+
|
6088
|
+
<span class='name'>content</span>
|
6089
|
+
|
6090
|
+
|
6091
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Mbrao::Content (class)">Content</a></span>|nil</tt>)</span>
|
6092
|
+
|
6093
|
+
|
6094
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
6095
|
+
|
6096
|
+
|
6097
|
+
—
|
6098
|
+
<div class='inline'><p>An optional content to check for availability</p>
|
6099
|
+
</div>
|
6100
|
+
|
6101
|
+
</li>
|
6102
|
+
|
5404
6103
|
</ul>
|
5405
6104
|
|
5406
6105
|
<p class="tag_title">Returns:</p>
|
@@ -5440,15 +6139,15 @@ used.</p>
|
|
5440
6139
|
<pre class="lines">
|
5441
6140
|
|
5442
6141
|
|
5443
|
-
|
5444
|
-
|
5445
|
-
|
5446
|
-
|
5447
|
-
|
5448
|
-
|
6142
|
+
257
|
6143
|
+
258
|
6144
|
+
259
|
6145
|
+
260
|
6146
|
+
261
|
6147
|
+
262</pre>
|
5449
6148
|
</td>
|
5450
6149
|
<td>
|
5451
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
6150
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 257</span>
|
5452
6151
|
|
5453
6152
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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>
|
5454
6153
|
<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>
|
@@ -5536,16 +6235,16 @@ The only supported value are:</p>
|
|
5536
6235
|
<pre class="lines">
|
5537
6236
|
|
5538
6237
|
|
5539
|
-
|
5540
|
-
|
5541
|
-
|
5542
|
-
|
6238
|
+
246
|
6239
|
+
247
|
6240
|
+
248
|
6241
|
+
249</pre>
|
5543
6242
|
</td>
|
5544
6243
|
<td>
|
5545
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line
|
6244
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/content.rb', line 246</span>
|
5546
6245
|
|
5547
6246
|
<span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</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>
|
5548
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
6247
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:uid</span><span class='comma'>,</span> <span class='symbol'>:locales</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:summary</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:tags</span><span class='comma'>,</span> <span class='symbol'>:more</span><span class='comma'>,</span> <span class='symbol'>:author</span><span class='comma'>,</span> <span class='symbol'>:created_at</span><span class='comma'>,</span> <span class='symbol'>:updated_at</span><span class='comma'>,</span> <span class='symbol'>:metadata</span><span class='rbracket'>]</span>
|
5549
6248
|
<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_as_json'>as_json</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
5550
6249
|
<span class='kw'>end</span></pre>
|
5551
6250
|
</td>
|
@@ -5558,7 +6257,7 @@ The only supported value are:</p>
|
|
5558
6257
|
</div>
|
5559
6258
|
|
5560
6259
|
<div id="footer">
|
5561
|
-
Generated on Sun Nov 24 14:
|
6260
|
+
Generated on Sun Nov 24 14:38:52 2013 by
|
5562
6261
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
5563
6262
|
0.8.7.3 (ruby-2.0.0).
|
5564
6263
|
</div>
|