mbrao 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis-gemfile +13 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/Gemfile +21 -0
- data/README.md +60 -0
- data/Rakefile +11 -0
- data/doc/ActionView/Template/Handlers/MbraoTemplate.html +568 -0
- data/doc/ActionView/Template/Handlers.html +125 -0
- data/doc/HTML/Pipeline/KramdownFilter.html +354 -0
- data/doc/HTML/Pipeline.html +140 -0
- data/doc/HTML.html +125 -0
- data/doc/Mbrao/Author.html +1402 -0
- data/doc/Mbrao/Content.html +4779 -0
- data/doc/Mbrao/ContentPublicInterface.html +658 -0
- data/doc/Mbrao/Exceptions/InvalidDate.html +133 -0
- data/doc/Mbrao/Exceptions/InvalidMetadata.html +133 -0
- data/doc/Mbrao/Exceptions/Parsing.html +133 -0
- data/doc/Mbrao/Exceptions/Rendering.html +133 -0
- data/doc/Mbrao/Exceptions/UnavailableLocalization.html +133 -0
- data/doc/Mbrao/Exceptions/Unimplemented.html +133 -0
- data/doc/Mbrao/Exceptions/UnknownEngine.html +133 -0
- data/doc/Mbrao/Exceptions.html +125 -0
- data/doc/Mbrao/Parser.html +418 -0
- data/doc/Mbrao/ParsingEngines/Base.html +658 -0
- data/doc/Mbrao/ParsingEngines/PlainText.html +571 -0
- data/doc/Mbrao/ParsingEngines.html +127 -0
- data/doc/Mbrao/PublicInterface/ClassMethods.html +1727 -0
- data/doc/Mbrao/PublicInterface.html +134 -0
- data/doc/Mbrao/RenderingEngines/Base.html +280 -0
- data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +873 -0
- data/doc/Mbrao/RenderingEngines.html +127 -0
- data/doc/Mbrao/Validations/ClassMethods.html +692 -0
- data/doc/Mbrao/Validations.html +134 -0
- data/doc/Mbrao/Version.html +189 -0
- data/doc/Mbrao.html +130 -0
- data/doc/_index.html +395 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +135 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +135 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +516 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/mbrao/author.rb +61 -0
- data/lib/mbrao/content.rb +300 -0
- data/lib/mbrao/exceptions.rb +38 -0
- data/lib/mbrao/integrations/rails.rb +51 -0
- data/lib/mbrao/parser.rb +276 -0
- data/lib/mbrao/parsing_engines/base.rb +51 -0
- data/lib/mbrao/parsing_engines/plain_text.rb +187 -0
- data/lib/mbrao/rendering_engines/base.rb +22 -0
- data/lib/mbrao/rendering_engines/html_pipeline.rb +147 -0
- data/lib/mbrao/version.rb +25 -0
- data/lib/mbrao.rb +24 -0
- data/mbrao.gemspec +31 -0
- data/spec/coverage_helper.rb +17 -0
- data/spec/mbrao/author_spec.rb +62 -0
- data/spec/mbrao/content_spec.rb +280 -0
- data/spec/mbrao/integrations/rails_spec.rb +92 -0
- data/spec/mbrao/parser_spec.rb +269 -0
- data/spec/mbrao/parsing_engines/base_spec.rb +52 -0
- data/spec/mbrao/parsing_engines/plain_text_spec.rb +141 -0
- data/spec/mbrao/rendering_engines/base_spec.rb +17 -0
- data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +128 -0
- data/spec/spec_helper.rb +15 -0
- metadata +195 -0
@@ -0,0 +1,1402 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Mbrao::Author
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (A)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Mbrao.html" title="Mbrao (module)">Mbrao</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Author</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Mbrao::Author
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Mbrao::Author</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/mbrao/author.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p>Represents the author of a parsed content, with its metadata.</p>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<div class="tags">
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
117
|
+
<ul class="summary">
|
118
|
+
|
119
|
+
<li class="public ">
|
120
|
+
<span class="summary_signature">
|
121
|
+
|
122
|
+
<a href="#email-instance_method" title="#email (instance method)">- (String) <strong>email</strong> </a>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
</span>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<span class="summary_desc"><div class='inline'><p>The email of the author.</p>
|
140
|
+
</div></span>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#image-instance_method" title="#image (instance method)">- (String) <strong>image</strong> </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<span class="summary_desc"><div class='inline'><p>The URL of the avatar of the author.</p>
|
166
|
+
</div></span>
|
167
|
+
|
168
|
+
</li>
|
169
|
+
|
170
|
+
|
171
|
+
<li class="public ">
|
172
|
+
<span class="summary_signature">
|
173
|
+
|
174
|
+
<a href="#metadata-instance_method" title="#metadata (instance method)">- (HashWithIndifferentAccess) <strong>metadata</strong> </a>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</span>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'><p>The full list of metadata of this author.</p>
|
192
|
+
</div></span>
|
193
|
+
|
194
|
+
</li>
|
195
|
+
|
196
|
+
|
197
|
+
<li class="public ">
|
198
|
+
<span class="summary_signature">
|
199
|
+
|
200
|
+
<a href="#name-instance_method" title="#name (instance method)">- (String) <strong>name</strong> </a>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</span>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="summary_desc"><div class='inline'><p>The name of the author.</p>
|
218
|
+
</div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#uid-instance_method" title="#uid (instance method)">- (String) <strong>uid</strong> </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<span class="summary_desc"><div class='inline'><p>A unique ID for this post.</p>
|
244
|
+
</div></span>
|
245
|
+
|
246
|
+
</li>
|
247
|
+
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#website-instance_method" title="#website (instance method)">- (String) <strong>website</strong> </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<span class="summary_desc"><div class='inline'><p>The website of the author.</p>
|
270
|
+
</div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<h2>
|
282
|
+
Class Method Summary
|
283
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
284
|
+
</h2>
|
285
|
+
|
286
|
+
<ul class="summary">
|
287
|
+
|
288
|
+
<li class="public ">
|
289
|
+
<span class="summary_signature">
|
290
|
+
|
291
|
+
<a href="#create-class_method" title="create (class method)">+ (Author) <strong>create</strong>(data) </a>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</span>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
<span class="summary_desc"><div class='inline'><p>Creates an author from a <code>Hash</code>.</p>
|
306
|
+
</div></span>
|
307
|
+
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
311
|
+
</ul>
|
312
|
+
|
313
|
+
<h2>
|
314
|
+
Instance Method Summary
|
315
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
316
|
+
</h2>
|
317
|
+
|
318
|
+
<ul class="summary">
|
319
|
+
|
320
|
+
<li class="public ">
|
321
|
+
<span class="summary_signature">
|
322
|
+
|
323
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Author) <strong>initialize</strong>(name, email = nil, website = nil, image = nil, metadata = nil, uid = nil) </a>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</span>
|
328
|
+
|
329
|
+
|
330
|
+
<span class="note title constructor">constructor</span>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new author.</p>
|
340
|
+
</div></span>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
|
345
|
+
</ul>
|
346
|
+
|
347
|
+
|
348
|
+
<div id="constructor_details" class="method_details_list">
|
349
|
+
<h2>Constructor Details</h2>
|
350
|
+
|
351
|
+
<div class="method_details first">
|
352
|
+
<h3 class="signature first" id="initialize-instance_method">
|
353
|
+
|
354
|
+
- (<tt><span class='object_link'><a href="" title="Mbrao::Author (class)">Author</a></span></tt>) <strong>initialize</strong>(name, email = nil, website = nil, image = nil, metadata = nil, uid = nil)
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</h3><div class="docstring">
|
361
|
+
<div class="discussion">
|
362
|
+
<p>Creates a new author.</p>
|
363
|
+
|
364
|
+
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
<div class="tags">
|
368
|
+
<p class="tag_title">Parameters:</p>
|
369
|
+
<ul class="param">
|
370
|
+
|
371
|
+
<li>
|
372
|
+
|
373
|
+
<span class='name'>name</span>
|
374
|
+
|
375
|
+
|
376
|
+
<span class='type'>(<tt>String</tt>)</span>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
—
|
381
|
+
<div class='inline'><p>The name of the author.</p>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</li>
|
385
|
+
|
386
|
+
<li>
|
387
|
+
|
388
|
+
<span class='name'>email</span>
|
389
|
+
|
390
|
+
|
391
|
+
<span class='type'>(<tt>String</tt>)</span>
|
392
|
+
|
393
|
+
|
394
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
395
|
+
|
396
|
+
|
397
|
+
—
|
398
|
+
<div class='inline'><p>The email of the author.</p>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
</li>
|
402
|
+
|
403
|
+
<li>
|
404
|
+
|
405
|
+
<span class='name'>website</span>
|
406
|
+
|
407
|
+
|
408
|
+
<span class='type'>(<tt>String</tt>)</span>
|
409
|
+
|
410
|
+
|
411
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
412
|
+
|
413
|
+
|
414
|
+
—
|
415
|
+
<div class='inline'><p>The website of the author.</p>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
</li>
|
419
|
+
|
420
|
+
<li>
|
421
|
+
|
422
|
+
<span class='name'>image</span>
|
423
|
+
|
424
|
+
|
425
|
+
<span class='type'>(<tt>String</tt>)</span>
|
426
|
+
|
427
|
+
|
428
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
429
|
+
|
430
|
+
|
431
|
+
—
|
432
|
+
<div class='inline'><p>The URL of the avatar of the author.</p>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
</li>
|
436
|
+
|
437
|
+
<li>
|
438
|
+
|
439
|
+
<span class='name'>metadata</span>
|
440
|
+
|
441
|
+
|
442
|
+
<span class='type'>(<tt>HashWithIndifferentAccess</tt>)</span>
|
443
|
+
|
444
|
+
|
445
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
446
|
+
|
447
|
+
|
448
|
+
—
|
449
|
+
<div class='inline'><p>The full list of metadata of this author.</p>
|
450
|
+
</div>
|
451
|
+
|
452
|
+
</li>
|
453
|
+
|
454
|
+
<li>
|
455
|
+
|
456
|
+
<span class='name'>uid</span>
|
457
|
+
|
458
|
+
|
459
|
+
<span class='type'>(<tt>String</tt>)</span>
|
460
|
+
|
461
|
+
|
462
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
463
|
+
|
464
|
+
|
465
|
+
—
|
466
|
+
<div class='inline'><p>A unique ID for this post. This is only for client uses.</p>
|
467
|
+
</div>
|
468
|
+
|
469
|
+
</li>
|
470
|
+
|
471
|
+
</ul>
|
472
|
+
|
473
|
+
|
474
|
+
</div><table class="source_code">
|
475
|
+
<tr>
|
476
|
+
<td>
|
477
|
+
<pre class="lines">
|
478
|
+
|
479
|
+
|
480
|
+
38
|
481
|
+
39
|
482
|
+
40
|
483
|
+
41
|
484
|
+
42
|
485
|
+
43
|
486
|
+
44
|
487
|
+
45</pre>
|
488
|
+
</td>
|
489
|
+
<td>
|
490
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 38</span>
|
491
|
+
|
492
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
493
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
494
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
495
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
496
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
497
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
498
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
499
|
+
<span class='kw'>end</span></pre>
|
500
|
+
</td>
|
501
|
+
</tr>
|
502
|
+
</table>
|
503
|
+
</div>
|
504
|
+
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div id="instance_attr_details" class="attr_details">
|
508
|
+
<h2>Instance Attribute Details</h2>
|
509
|
+
|
510
|
+
|
511
|
+
<span id="email=-instance_method"></span>
|
512
|
+
<div class="method_details first">
|
513
|
+
<h3 class="signature first" id="email-instance_method">
|
514
|
+
|
515
|
+
- (<tt>String</tt>) <strong>email</strong>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</h3><div class="docstring">
|
522
|
+
<div class="discussion">
|
523
|
+
<p>The email of the author.</p>
|
524
|
+
|
525
|
+
|
526
|
+
</div>
|
527
|
+
</div>
|
528
|
+
<div class="tags">
|
529
|
+
|
530
|
+
<p class="tag_title">Returns:</p>
|
531
|
+
<ul class="return">
|
532
|
+
|
533
|
+
<li>
|
534
|
+
|
535
|
+
|
536
|
+
<span class='type'>(<tt>String</tt>)</span>
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
—
|
541
|
+
<div class='inline'><p>The email of the author.</p>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
</li>
|
545
|
+
|
546
|
+
</ul>
|
547
|
+
|
548
|
+
</div><table class="source_code">
|
549
|
+
<tr>
|
550
|
+
<td>
|
551
|
+
<pre class="lines">
|
552
|
+
|
553
|
+
|
554
|
+
22
|
555
|
+
23
|
556
|
+
24
|
557
|
+
25
|
558
|
+
26
|
559
|
+
27
|
560
|
+
28
|
561
|
+
29
|
562
|
+
30
|
563
|
+
31
|
564
|
+
32
|
565
|
+
33
|
566
|
+
34
|
567
|
+
35
|
568
|
+
36
|
569
|
+
37
|
570
|
+
38
|
571
|
+
39
|
572
|
+
40
|
573
|
+
41
|
574
|
+
42
|
575
|
+
43
|
576
|
+
44
|
577
|
+
45
|
578
|
+
46
|
579
|
+
47
|
580
|
+
48
|
581
|
+
49
|
582
|
+
50
|
583
|
+
51
|
584
|
+
52
|
585
|
+
53
|
586
|
+
54
|
587
|
+
55
|
588
|
+
56
|
589
|
+
57
|
590
|
+
58
|
591
|
+
59
|
592
|
+
60</pre>
|
593
|
+
</td>
|
594
|
+
<td>
|
595
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
596
|
+
|
597
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
598
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
599
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
600
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
601
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
602
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
603
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
604
|
+
|
605
|
+
<span class='comment'># Creates a new author.
|
606
|
+
</span> <span class='comment'>#
|
607
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
608
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
609
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
610
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
611
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
612
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
613
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
614
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
615
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
616
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
617
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
618
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
619
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
620
|
+
<span class='kw'>end</span>
|
621
|
+
|
622
|
+
<span class='comment'># Creates an author from a `Hash`.
|
623
|
+
</span> <span class='comment'>#
|
624
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
625
|
+
</span> <span class='comment'># @return [Author] A new author.
|
626
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
627
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
628
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
629
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
630
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
631
|
+
<span class='kw'>else</span>
|
632
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
633
|
+
<span class='kw'>end</span>
|
634
|
+
<span class='kw'>end</span>
|
635
|
+
<span class='kw'>end</span></pre>
|
636
|
+
</td>
|
637
|
+
</tr>
|
638
|
+
</table>
|
639
|
+
</div>
|
640
|
+
|
641
|
+
|
642
|
+
<span id="image=-instance_method"></span>
|
643
|
+
<div class="method_details ">
|
644
|
+
<h3 class="signature " id="image-instance_method">
|
645
|
+
|
646
|
+
- (<tt>String</tt>) <strong>image</strong>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
</h3><div class="docstring">
|
653
|
+
<div class="discussion">
|
654
|
+
<p>The URL of the avatar of the author.</p>
|
655
|
+
|
656
|
+
|
657
|
+
</div>
|
658
|
+
</div>
|
659
|
+
<div class="tags">
|
660
|
+
|
661
|
+
<p class="tag_title">Returns:</p>
|
662
|
+
<ul class="return">
|
663
|
+
|
664
|
+
<li>
|
665
|
+
|
666
|
+
|
667
|
+
<span class='type'>(<tt>String</tt>)</span>
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
—
|
672
|
+
<div class='inline'><p>The URL of the avatar of the author.</p>
|
673
|
+
</div>
|
674
|
+
|
675
|
+
</li>
|
676
|
+
|
677
|
+
</ul>
|
678
|
+
|
679
|
+
</div><table class="source_code">
|
680
|
+
<tr>
|
681
|
+
<td>
|
682
|
+
<pre class="lines">
|
683
|
+
|
684
|
+
|
685
|
+
22
|
686
|
+
23
|
687
|
+
24
|
688
|
+
25
|
689
|
+
26
|
690
|
+
27
|
691
|
+
28
|
692
|
+
29
|
693
|
+
30
|
694
|
+
31
|
695
|
+
32
|
696
|
+
33
|
697
|
+
34
|
698
|
+
35
|
699
|
+
36
|
700
|
+
37
|
701
|
+
38
|
702
|
+
39
|
703
|
+
40
|
704
|
+
41
|
705
|
+
42
|
706
|
+
43
|
707
|
+
44
|
708
|
+
45
|
709
|
+
46
|
710
|
+
47
|
711
|
+
48
|
712
|
+
49
|
713
|
+
50
|
714
|
+
51
|
715
|
+
52
|
716
|
+
53
|
717
|
+
54
|
718
|
+
55
|
719
|
+
56
|
720
|
+
57
|
721
|
+
58
|
722
|
+
59
|
723
|
+
60</pre>
|
724
|
+
</td>
|
725
|
+
<td>
|
726
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
727
|
+
|
728
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
729
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
730
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
731
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
732
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
733
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
734
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
735
|
+
|
736
|
+
<span class='comment'># Creates a new author.
|
737
|
+
</span> <span class='comment'>#
|
738
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
739
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
740
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
741
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
742
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
743
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
744
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
745
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
746
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
747
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
748
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
749
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
750
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
751
|
+
<span class='kw'>end</span>
|
752
|
+
|
753
|
+
<span class='comment'># Creates an author from a `Hash`.
|
754
|
+
</span> <span class='comment'>#
|
755
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
756
|
+
</span> <span class='comment'># @return [Author] A new author.
|
757
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
758
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
759
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
760
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
761
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
762
|
+
<span class='kw'>else</span>
|
763
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
764
|
+
<span class='kw'>end</span>
|
765
|
+
<span class='kw'>end</span>
|
766
|
+
<span class='kw'>end</span></pre>
|
767
|
+
</td>
|
768
|
+
</tr>
|
769
|
+
</table>
|
770
|
+
</div>
|
771
|
+
|
772
|
+
|
773
|
+
<span id="metadata=-instance_method"></span>
|
774
|
+
<div class="method_details ">
|
775
|
+
<h3 class="signature " id="metadata-instance_method">
|
776
|
+
|
777
|
+
- (<tt>HashWithIndifferentAccess</tt>) <strong>metadata</strong>
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
|
783
|
+
</h3><div class="docstring">
|
784
|
+
<div class="discussion">
|
785
|
+
<p>The full list of metadata of this author.</p>
|
786
|
+
|
787
|
+
|
788
|
+
</div>
|
789
|
+
</div>
|
790
|
+
<div class="tags">
|
791
|
+
|
792
|
+
<p class="tag_title">Returns:</p>
|
793
|
+
<ul class="return">
|
794
|
+
|
795
|
+
<li>
|
796
|
+
|
797
|
+
|
798
|
+
<span class='type'>(<tt>HashWithIndifferentAccess</tt>)</span>
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
—
|
803
|
+
<div class='inline'><p>The full list of metadata of this author.</p>
|
804
|
+
</div>
|
805
|
+
|
806
|
+
</li>
|
807
|
+
|
808
|
+
</ul>
|
809
|
+
|
810
|
+
</div><table class="source_code">
|
811
|
+
<tr>
|
812
|
+
<td>
|
813
|
+
<pre class="lines">
|
814
|
+
|
815
|
+
|
816
|
+
22
|
817
|
+
23
|
818
|
+
24
|
819
|
+
25
|
820
|
+
26
|
821
|
+
27
|
822
|
+
28
|
823
|
+
29
|
824
|
+
30
|
825
|
+
31
|
826
|
+
32
|
827
|
+
33
|
828
|
+
34
|
829
|
+
35
|
830
|
+
36
|
831
|
+
37
|
832
|
+
38
|
833
|
+
39
|
834
|
+
40
|
835
|
+
41
|
836
|
+
42
|
837
|
+
43
|
838
|
+
44
|
839
|
+
45
|
840
|
+
46
|
841
|
+
47
|
842
|
+
48
|
843
|
+
49
|
844
|
+
50
|
845
|
+
51
|
846
|
+
52
|
847
|
+
53
|
848
|
+
54
|
849
|
+
55
|
850
|
+
56
|
851
|
+
57
|
852
|
+
58
|
853
|
+
59
|
854
|
+
60</pre>
|
855
|
+
</td>
|
856
|
+
<td>
|
857
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
858
|
+
|
859
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
860
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
861
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
862
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
863
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
864
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
865
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
866
|
+
|
867
|
+
<span class='comment'># Creates a new author.
|
868
|
+
</span> <span class='comment'>#
|
869
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
870
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
871
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
872
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
873
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
874
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
875
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
876
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
877
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
878
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
879
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
880
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
881
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
882
|
+
<span class='kw'>end</span>
|
883
|
+
|
884
|
+
<span class='comment'># Creates an author from a `Hash`.
|
885
|
+
</span> <span class='comment'>#
|
886
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
887
|
+
</span> <span class='comment'># @return [Author] A new author.
|
888
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
889
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
890
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
891
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
892
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
893
|
+
<span class='kw'>else</span>
|
894
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
895
|
+
<span class='kw'>end</span>
|
896
|
+
<span class='kw'>end</span>
|
897
|
+
<span class='kw'>end</span></pre>
|
898
|
+
</td>
|
899
|
+
</tr>
|
900
|
+
</table>
|
901
|
+
</div>
|
902
|
+
|
903
|
+
|
904
|
+
<span id="name=-instance_method"></span>
|
905
|
+
<div class="method_details ">
|
906
|
+
<h3 class="signature " id="name-instance_method">
|
907
|
+
|
908
|
+
- (<tt>String</tt>) <strong>name</strong>
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
|
913
|
+
|
914
|
+
</h3><div class="docstring">
|
915
|
+
<div class="discussion">
|
916
|
+
<p>The name of the author.</p>
|
917
|
+
|
918
|
+
|
919
|
+
</div>
|
920
|
+
</div>
|
921
|
+
<div class="tags">
|
922
|
+
|
923
|
+
<p class="tag_title">Returns:</p>
|
924
|
+
<ul class="return">
|
925
|
+
|
926
|
+
<li>
|
927
|
+
|
928
|
+
|
929
|
+
<span class='type'>(<tt>String</tt>)</span>
|
930
|
+
|
931
|
+
|
932
|
+
|
933
|
+
—
|
934
|
+
<div class='inline'><p>The name of the author.</p>
|
935
|
+
</div>
|
936
|
+
|
937
|
+
</li>
|
938
|
+
|
939
|
+
</ul>
|
940
|
+
|
941
|
+
</div><table class="source_code">
|
942
|
+
<tr>
|
943
|
+
<td>
|
944
|
+
<pre class="lines">
|
945
|
+
|
946
|
+
|
947
|
+
22
|
948
|
+
23
|
949
|
+
24
|
950
|
+
25
|
951
|
+
26
|
952
|
+
27
|
953
|
+
28
|
954
|
+
29
|
955
|
+
30
|
956
|
+
31
|
957
|
+
32
|
958
|
+
33
|
959
|
+
34
|
960
|
+
35
|
961
|
+
36
|
962
|
+
37
|
963
|
+
38
|
964
|
+
39
|
965
|
+
40
|
966
|
+
41
|
967
|
+
42
|
968
|
+
43
|
969
|
+
44
|
970
|
+
45
|
971
|
+
46
|
972
|
+
47
|
973
|
+
48
|
974
|
+
49
|
975
|
+
50
|
976
|
+
51
|
977
|
+
52
|
978
|
+
53
|
979
|
+
54
|
980
|
+
55
|
981
|
+
56
|
982
|
+
57
|
983
|
+
58
|
984
|
+
59
|
985
|
+
60</pre>
|
986
|
+
</td>
|
987
|
+
<td>
|
988
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
989
|
+
|
990
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
991
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
992
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
993
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
994
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
995
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
996
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
997
|
+
|
998
|
+
<span class='comment'># Creates a new author.
|
999
|
+
</span> <span class='comment'>#
|
1000
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
1001
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
1002
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
1003
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
1004
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
1005
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
1006
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1007
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1008
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1009
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1010
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1011
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
1012
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
1013
|
+
<span class='kw'>end</span>
|
1014
|
+
|
1015
|
+
<span class='comment'># Creates an author from a `Hash`.
|
1016
|
+
</span> <span class='comment'>#
|
1017
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
1018
|
+
</span> <span class='comment'># @return [Author] A new author.
|
1019
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
1020
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1021
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1022
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
1023
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
1024
|
+
<span class='kw'>else</span>
|
1025
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
1026
|
+
<span class='kw'>end</span>
|
1027
|
+
<span class='kw'>end</span>
|
1028
|
+
<span class='kw'>end</span></pre>
|
1029
|
+
</td>
|
1030
|
+
</tr>
|
1031
|
+
</table>
|
1032
|
+
</div>
|
1033
|
+
|
1034
|
+
|
1035
|
+
<span id="uid=-instance_method"></span>
|
1036
|
+
<div class="method_details ">
|
1037
|
+
<h3 class="signature " id="uid-instance_method">
|
1038
|
+
|
1039
|
+
- (<tt>String</tt>) <strong>uid</strong>
|
1040
|
+
|
1041
|
+
|
1042
|
+
|
1043
|
+
|
1044
|
+
|
1045
|
+
</h3><div class="docstring">
|
1046
|
+
<div class="discussion">
|
1047
|
+
<p>A unique ID for this post. This is only for client uses.</p>
|
1048
|
+
|
1049
|
+
|
1050
|
+
</div>
|
1051
|
+
</div>
|
1052
|
+
<div class="tags">
|
1053
|
+
|
1054
|
+
<p class="tag_title">Returns:</p>
|
1055
|
+
<ul class="return">
|
1056
|
+
|
1057
|
+
<li>
|
1058
|
+
|
1059
|
+
|
1060
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1064
|
+
—
|
1065
|
+
<div class='inline'><p>A unique ID for this post. This is only for client uses.</p>
|
1066
|
+
</div>
|
1067
|
+
|
1068
|
+
</li>
|
1069
|
+
|
1070
|
+
</ul>
|
1071
|
+
|
1072
|
+
</div><table class="source_code">
|
1073
|
+
<tr>
|
1074
|
+
<td>
|
1075
|
+
<pre class="lines">
|
1076
|
+
|
1077
|
+
|
1078
|
+
22
|
1079
|
+
23
|
1080
|
+
24
|
1081
|
+
25
|
1082
|
+
26
|
1083
|
+
27
|
1084
|
+
28
|
1085
|
+
29
|
1086
|
+
30
|
1087
|
+
31
|
1088
|
+
32
|
1089
|
+
33
|
1090
|
+
34
|
1091
|
+
35
|
1092
|
+
36
|
1093
|
+
37
|
1094
|
+
38
|
1095
|
+
39
|
1096
|
+
40
|
1097
|
+
41
|
1098
|
+
42
|
1099
|
+
43
|
1100
|
+
44
|
1101
|
+
45
|
1102
|
+
46
|
1103
|
+
47
|
1104
|
+
48
|
1105
|
+
49
|
1106
|
+
50
|
1107
|
+
51
|
1108
|
+
52
|
1109
|
+
53
|
1110
|
+
54
|
1111
|
+
55
|
1112
|
+
56
|
1113
|
+
57
|
1114
|
+
58
|
1115
|
+
59
|
1116
|
+
60</pre>
|
1117
|
+
</td>
|
1118
|
+
<td>
|
1119
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
1120
|
+
|
1121
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
1122
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
1123
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
1124
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
1125
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
1126
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
1127
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
1128
|
+
|
1129
|
+
<span class='comment'># Creates a new author.
|
1130
|
+
</span> <span class='comment'>#
|
1131
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
1132
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
1133
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
1134
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
1135
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
1136
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
1137
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1138
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1139
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1140
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1141
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1142
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
1143
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
1144
|
+
<span class='kw'>end</span>
|
1145
|
+
|
1146
|
+
<span class='comment'># Creates an author from a `Hash`.
|
1147
|
+
</span> <span class='comment'>#
|
1148
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
1149
|
+
</span> <span class='comment'># @return [Author] A new author.
|
1150
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
1151
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1152
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1153
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
1154
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
1155
|
+
<span class='kw'>else</span>
|
1156
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
1157
|
+
<span class='kw'>end</span>
|
1158
|
+
<span class='kw'>end</span>
|
1159
|
+
<span class='kw'>end</span></pre>
|
1160
|
+
</td>
|
1161
|
+
</tr>
|
1162
|
+
</table>
|
1163
|
+
</div>
|
1164
|
+
|
1165
|
+
|
1166
|
+
<span id="website=-instance_method"></span>
|
1167
|
+
<div class="method_details ">
|
1168
|
+
<h3 class="signature " id="website-instance_method">
|
1169
|
+
|
1170
|
+
- (<tt>String</tt>) <strong>website</strong>
|
1171
|
+
|
1172
|
+
|
1173
|
+
|
1174
|
+
|
1175
|
+
|
1176
|
+
</h3><div class="docstring">
|
1177
|
+
<div class="discussion">
|
1178
|
+
<p>The website of the author.</p>
|
1179
|
+
|
1180
|
+
|
1181
|
+
</div>
|
1182
|
+
</div>
|
1183
|
+
<div class="tags">
|
1184
|
+
|
1185
|
+
<p class="tag_title">Returns:</p>
|
1186
|
+
<ul class="return">
|
1187
|
+
|
1188
|
+
<li>
|
1189
|
+
|
1190
|
+
|
1191
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1192
|
+
|
1193
|
+
|
1194
|
+
|
1195
|
+
—
|
1196
|
+
<div class='inline'><p>The website of the author.</p>
|
1197
|
+
</div>
|
1198
|
+
|
1199
|
+
</li>
|
1200
|
+
|
1201
|
+
</ul>
|
1202
|
+
|
1203
|
+
</div><table class="source_code">
|
1204
|
+
<tr>
|
1205
|
+
<td>
|
1206
|
+
<pre class="lines">
|
1207
|
+
|
1208
|
+
|
1209
|
+
22
|
1210
|
+
23
|
1211
|
+
24
|
1212
|
+
25
|
1213
|
+
26
|
1214
|
+
27
|
1215
|
+
28
|
1216
|
+
29
|
1217
|
+
30
|
1218
|
+
31
|
1219
|
+
32
|
1220
|
+
33
|
1221
|
+
34
|
1222
|
+
35
|
1223
|
+
36
|
1224
|
+
37
|
1225
|
+
38
|
1226
|
+
39
|
1227
|
+
40
|
1228
|
+
41
|
1229
|
+
42
|
1230
|
+
43
|
1231
|
+
44
|
1232
|
+
45
|
1233
|
+
46
|
1234
|
+
47
|
1235
|
+
48
|
1236
|
+
49
|
1237
|
+
50
|
1238
|
+
51
|
1239
|
+
52
|
1240
|
+
53
|
1241
|
+
54
|
1242
|
+
55
|
1243
|
+
56
|
1244
|
+
57
|
1245
|
+
58
|
1246
|
+
59
|
1247
|
+
60</pre>
|
1248
|
+
</td>
|
1249
|
+
<td>
|
1250
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 22</span>
|
1251
|
+
|
1252
|
+
<span class='kw'>class</span> <span class='const'>Author</span>
|
1253
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:uid</span>
|
1254
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:name</span>
|
1255
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:email</span>
|
1256
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:website</span>
|
1257
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:image</span>
|
1258
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:metadata</span>
|
1259
|
+
|
1260
|
+
<span class='comment'># Creates a new author.
|
1261
|
+
</span> <span class='comment'>#
|
1262
|
+
</span> <span class='comment'># @param name [String] The name of the author.
|
1263
|
+
</span> <span class='comment'># @param email [String] The email of the author.
|
1264
|
+
</span> <span class='comment'># @param website [String] The website of the author.
|
1265
|
+
</span> <span class='comment'># @param image [String] The URL of the avatar of the author.
|
1266
|
+
</span> <span class='comment'># @param metadata [HashWithIndifferentAccess] The full list of metadata of this author.
|
1267
|
+
</span> <span class='comment'># @param uid [String] A unique ID for this post. This is only for client uses.
|
1268
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1269
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
1270
|
+
<span class='ivar'>@email</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_email?'>is_email?</span><span class='lparen'>(</span><span class='id identifier rubyid_email'>email</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_email'>email</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1271
|
+
<span class='ivar'>@website</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_website'>website</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_website'>website</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1272
|
+
<span class='ivar'>@image</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_is_url?'>is_url?</span><span class='lparen'>(</span><span class='id identifier rubyid_image'>image</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_image'>image</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1273
|
+
<span class='ivar'>@metadata</span> <span class='op'>=</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_sanitized_hash'>sanitized_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
1274
|
+
<span class='ivar'>@uid</span> <span class='op'>=</span> <span class='id identifier rubyid_uid'>uid</span>
|
1275
|
+
<span class='kw'>end</span>
|
1276
|
+
|
1277
|
+
<span class='comment'># Creates an author from a `Hash`.
|
1278
|
+
</span> <span class='comment'>#
|
1279
|
+
</span> <span class='comment'># @param data [Hash] The data of the author
|
1280
|
+
</span> <span class='comment'># @return [Author] A new author.
|
1281
|
+
</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_data'>data</span><span class='rparen'>)</span>
|
1282
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1283
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1284
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
1285
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
1286
|
+
<span class='kw'>else</span>
|
1287
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
1288
|
+
<span class='kw'>end</span>
|
1289
|
+
<span class='kw'>end</span>
|
1290
|
+
<span class='kw'>end</span></pre>
|
1291
|
+
</td>
|
1292
|
+
</tr>
|
1293
|
+
</table>
|
1294
|
+
</div>
|
1295
|
+
|
1296
|
+
</div>
|
1297
|
+
|
1298
|
+
|
1299
|
+
<div id="class_method_details" class="method_details_list">
|
1300
|
+
<h2>Class Method Details</h2>
|
1301
|
+
|
1302
|
+
|
1303
|
+
<div class="method_details first">
|
1304
|
+
<h3 class="signature first" id="create-class_method">
|
1305
|
+
|
1306
|
+
+ (<tt><span class='object_link'><a href="" title="Mbrao::Author (class)">Author</a></span></tt>) <strong>create</strong>(data)
|
1307
|
+
|
1308
|
+
|
1309
|
+
|
1310
|
+
|
1311
|
+
|
1312
|
+
</h3><div class="docstring">
|
1313
|
+
<div class="discussion">
|
1314
|
+
<p>Creates an author from a <code>Hash</code>.</p>
|
1315
|
+
|
1316
|
+
|
1317
|
+
</div>
|
1318
|
+
</div>
|
1319
|
+
<div class="tags">
|
1320
|
+
<p class="tag_title">Parameters:</p>
|
1321
|
+
<ul class="param">
|
1322
|
+
|
1323
|
+
<li>
|
1324
|
+
|
1325
|
+
<span class='name'>data</span>
|
1326
|
+
|
1327
|
+
|
1328
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1329
|
+
|
1330
|
+
|
1331
|
+
|
1332
|
+
—
|
1333
|
+
<div class='inline'><p>The data of the author</p>
|
1334
|
+
</div>
|
1335
|
+
|
1336
|
+
</li>
|
1337
|
+
|
1338
|
+
</ul>
|
1339
|
+
|
1340
|
+
<p class="tag_title">Returns:</p>
|
1341
|
+
<ul class="return">
|
1342
|
+
|
1343
|
+
<li>
|
1344
|
+
|
1345
|
+
|
1346
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Mbrao::Author (class)">Author</a></span></tt>)</span>
|
1347
|
+
|
1348
|
+
|
1349
|
+
|
1350
|
+
—
|
1351
|
+
<div class='inline'><p>A new author.</p>
|
1352
|
+
</div>
|
1353
|
+
|
1354
|
+
</li>
|
1355
|
+
|
1356
|
+
</ul>
|
1357
|
+
|
1358
|
+
</div><table class="source_code">
|
1359
|
+
<tr>
|
1360
|
+
<td>
|
1361
|
+
<pre class="lines">
|
1362
|
+
|
1363
|
+
|
1364
|
+
51
|
1365
|
+
52
|
1366
|
+
53
|
1367
|
+
54
|
1368
|
+
55
|
1369
|
+
56
|
1370
|
+
57
|
1371
|
+
58
|
1372
|
+
59</pre>
|
1373
|
+
</td>
|
1374
|
+
<td>
|
1375
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/author.rb', line 51</span>
|
1376
|
+
|
1377
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
1378
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1379
|
+
<span class='id identifier rubyid_data'>data</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='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
1380
|
+
<span class='id identifier rubyid_uid'>uid</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</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>
|
1381
|
+
<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_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:email</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:website</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:image</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span>
|
1382
|
+
<span class='kw'>else</span>
|
1383
|
+
<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_data'>data</span><span class='rparen'>)</span>
|
1384
|
+
<span class='kw'>end</span>
|
1385
|
+
<span class='kw'>end</span></pre>
|
1386
|
+
</td>
|
1387
|
+
</tr>
|
1388
|
+
</table>
|
1389
|
+
</div>
|
1390
|
+
|
1391
|
+
</div>
|
1392
|
+
|
1393
|
+
</div>
|
1394
|
+
|
1395
|
+
<div id="footer">
|
1396
|
+
Generated on Fri Mar 1 09:13:31 2013 by
|
1397
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1398
|
+
0.8.5.2 (ruby-1.9.3).
|
1399
|
+
</div>
|
1400
|
+
|
1401
|
+
</body>
|
1402
|
+
</html>
|