prismic.io 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -14
- data/docs/Prismic.html +1074 -0
- data/docs/Prismic/API.html +2987 -0
- data/docs/Prismic/API/BadPrismicResponseError.html +147 -0
- data/docs/Prismic/API/OAuth.html +560 -0
- data/docs/Prismic/API/PrismicWSAuthError.html +375 -0
- data/docs/Prismic/API/PrismicWSConnectionError.html +221 -0
- data/docs/Prismic/BasicNullCache.html +255 -0
- data/docs/Prismic/DefaultHTTPClient.html +350 -0
- data/docs/Prismic/Document.html +873 -0
- data/docs/Prismic/Error.html +418 -0
- data/docs/Prismic/Experiment.html +633 -0
- data/docs/Prismic/Experiments.html +633 -0
- data/docs/Prismic/Field.html +424 -0
- data/docs/Prismic/Form.html +827 -0
- data/docs/Prismic/Fragments.html +117 -0
- data/docs/Prismic/Fragments/Color.html +632 -0
- data/docs/Prismic/Fragments/Date.html +399 -0
- data/docs/Prismic/Fragments/DocumentLink.html +1048 -0
- data/docs/Prismic/Fragments/Embed.html +679 -0
- data/docs/Prismic/Fragments/FileLink.html +604 -0
- data/docs/Prismic/Fragments/Fragment.html +339 -0
- data/docs/Prismic/Fragments/GeoPoint.html +469 -0
- data/docs/Prismic/Fragments/Group.html +710 -0
- data/docs/Prismic/Fragments/GroupDocument.html +382 -0
- data/docs/Prismic/Fragments/Image.html +780 -0
- data/docs/Prismic/Fragments/Image/View.html +759 -0
- data/docs/Prismic/Fragments/Image/ViewDoesNotExistException.html +147 -0
- data/docs/Prismic/Fragments/ImageLink.html +336 -0
- data/docs/Prismic/Fragments/Link.html +412 -0
- data/docs/Prismic/Fragments/Multiple.html +513 -0
- data/docs/Prismic/Fragments/Number.html +401 -0
- data/docs/Prismic/Fragments/Select.html +349 -0
- data/docs/Prismic/Fragments/Separator.html +396 -0
- data/docs/Prismic/Fragments/Slice.html +632 -0
- data/docs/Prismic/Fragments/SliceZone.html +474 -0
- data/docs/Prismic/Fragments/StructuredText.html +664 -0
- data/docs/Prismic/Fragments/StructuredText/Block.html +232 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Embed.html +367 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Heading.html +366 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Image.html +755 -0
- data/docs/Prismic/Fragments/StructuredText/Block/ListItem.html +372 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Paragraph.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Preformatted.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Text.html +818 -0
- data/docs/Prismic/Fragments/StructuredText/BlockGroup.html +423 -0
- data/docs/Prismic/Fragments/StructuredText/Span.html +384 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Em.html +213 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Hyperlink.html +359 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Label.html +362 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Strong.html +213 -0
- data/docs/Prismic/Fragments/Text.html +396 -0
- data/docs/Prismic/Fragments/Timestamp.html +399 -0
- data/docs/Prismic/Fragments/WebLink.html +340 -0
- data/docs/Prismic/HtmlSerializer.html +270 -0
- data/docs/Prismic/JsonParser.html +1764 -0
- data/docs/Prismic/LinkResolver.html +399 -0
- data/docs/Prismic/LruCache.html +1140 -0
- data/docs/Prismic/Predicates.html +1630 -0
- data/docs/Prismic/Ref.html +643 -0
- data/docs/Prismic/Response.html +1159 -0
- data/docs/Prismic/SearchForm.html +2172 -0
- data/docs/Prismic/SearchForm/AuthenticationException.html +147 -0
- data/docs/Prismic/SearchForm/AuthorizationException.html +147 -0
- data/docs/Prismic/SearchForm/FormSearchException.html +147 -0
- data/docs/Prismic/SearchForm/NoRefSetException.html +147 -0
- data/docs/Prismic/SearchForm/RefNotFoundException.html +147 -0
- data/docs/Prismic/SearchForm/UnsupportedFormKind.html +147 -0
- data/docs/Prismic/Variation.html +546 -0
- data/docs/Prismic/WithFragments.html +1803 -0
- data/docs/_index.html +752 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +57 -0
- data/docs/css/style.css +339 -0
- data/docs/file.README.html +180 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +26 -0
- data/docs/index.html +180 -0
- data/docs/js/app.js +219 -0
- data/docs/js/full_list.js +178 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +2381 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/prismic.rb +17 -1
- data/lib/prismic/api.rb +31 -19
- data/lib/prismic/fragments/image.rb +6 -0
- data/lib/prismic/json_parsers.rb +2 -0
- data/lib/prismic/version.rb +1 -1
- data/spec/cache_spec.rb +12 -12
- data/spec/json_parsers_spec.rb +10 -5
- data/spec/oauth_spec.rb +3 -3
- data/spec/prismic_spec.rb +7 -7
- data/spec/responses_mocks/api.json +12 -12
- data/spec/responses_mocks/document.json +4 -2
- data/spec/responses_mocks/document_with_unknown_fragment.json +2 -0
- data/spec/responses_mocks/fragments.json +5 -3
- data/spec/responses_mocks/slices.json +2 -0
- data/spec/responses_mocks/structured_text_with_labels.json +2 -2
- data/spec/simple_search_spec.rb +55 -0
- metadata +103 -24
- data/deploy-doc.sh +0 -9
- data/spec/doc_spec.rb +0 -298
- data/spec/lesbonneschoses_spec.rb +0 -228
@@ -0,0 +1,1764 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Prismic::JsonParser
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Prismic/JsonParser.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (J)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Prismic.html" title="Prismic (module)">Prismic</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">JsonParser</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Prismic::JsonParser
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/prismic/json_parsers.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
|
88
|
+
<h2>Constant Summary</h2>
|
89
|
+
|
90
|
+
<dl class="constants">
|
91
|
+
|
92
|
+
<dt id="warned_unknown_type-classvariable" class="">@@warned_unknown_type =
|
93
|
+
|
94
|
+
</dt>
|
95
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='rbracket'>]</span></pre></dd>
|
96
|
+
|
97
|
+
</dl>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<h2>
|
108
|
+
Class Method Summary
|
109
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
110
|
+
</h2>
|
111
|
+
|
112
|
+
<ul class="summary">
|
113
|
+
|
114
|
+
<li class="public ">
|
115
|
+
<span class="summary_signature">
|
116
|
+
|
117
|
+
<a href="#color_parser-class_method" title="color_parser (class method)">+ (Object) <strong>color_parser</strong>(json) </a>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
</span>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
132
|
+
|
133
|
+
</li>
|
134
|
+
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#date_parser-class_method" title="date_parser (class method)">+ (Object) <strong>date_parser</strong>(json) </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#document_link_parser-class_method" title="document_link_parser (class method)">+ (Object) <strong>document_link_parser</strong>(json) </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
<li class="public ">
|
181
|
+
<span class="summary_signature">
|
182
|
+
|
183
|
+
<a href="#document_parser-class_method" title="document_parser (class method)">+ (Object) <strong>document_parser</strong>(json) </a>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
</span>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
<li class="public ">
|
203
|
+
<span class="summary_signature">
|
204
|
+
|
205
|
+
<a href="#embed_parser-class_method" title="embed_parser (class method)">+ (Object) <strong>embed_parser</strong>(json) </a>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</span>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li class="public ">
|
225
|
+
<span class="summary_signature">
|
226
|
+
|
227
|
+
<a href="#file_link_parser-class_method" title="file_link_parser (class method)">+ (Object) <strong>file_link_parser</strong>(json) </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
|
246
|
+
<li class="public ">
|
247
|
+
<span class="summary_signature">
|
248
|
+
|
249
|
+
<a href="#fragment_parser-class_method" title="fragment_parser (class method)">+ (Object) <strong>fragment_parser</strong>(fragment) </a>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</span>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
264
|
+
|
265
|
+
</li>
|
266
|
+
|
267
|
+
|
268
|
+
<li class="public ">
|
269
|
+
<span class="summary_signature">
|
270
|
+
|
271
|
+
<a href="#geo_point_parser-class_method" title="geo_point_parser (class method)">+ (Object) <strong>geo_point_parser</strong>(json) </a>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
</span>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
286
|
+
|
287
|
+
</li>
|
288
|
+
|
289
|
+
|
290
|
+
<li class="public ">
|
291
|
+
<span class="summary_signature">
|
292
|
+
|
293
|
+
<a href="#group_parser-class_method" title="group_parser (class method)">+ (Object) <strong>group_parser</strong>(json) </a>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</span>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
|
312
|
+
<li class="public ">
|
313
|
+
<span class="summary_signature">
|
314
|
+
|
315
|
+
<a href="#image_link_parser-class_method" title="image_link_parser (class method)">+ (Object) <strong>image_link_parser</strong>(json) </a>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
|
334
|
+
<li class="public ">
|
335
|
+
<span class="summary_signature">
|
336
|
+
|
337
|
+
<a href="#image_parser-class_method" title="image_parser (class method)">+ (Object) <strong>image_parser</strong>(json) </a>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</span>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
352
|
+
|
353
|
+
</li>
|
354
|
+
|
355
|
+
|
356
|
+
<li class="public ">
|
357
|
+
<span class="summary_signature">
|
358
|
+
|
359
|
+
<a href="#multiple_parser-class_method" title="multiple_parser (class method)">+ (Object) <strong>multiple_parser</strong>(json) </a>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</span>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
374
|
+
|
375
|
+
</li>
|
376
|
+
|
377
|
+
|
378
|
+
<li class="public ">
|
379
|
+
<span class="summary_signature">
|
380
|
+
|
381
|
+
<a href="#number_parser-class_method" title="number_parser (class method)">+ (Object) <strong>number_parser</strong>(json) </a>
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
</span>
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
396
|
+
|
397
|
+
</li>
|
398
|
+
|
399
|
+
|
400
|
+
<li class="public ">
|
401
|
+
<span class="summary_signature">
|
402
|
+
|
403
|
+
<a href="#parsers-class_method" title="parsers (class method)">+ (Object) <strong>parsers</strong> </a>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
</span>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
418
|
+
|
419
|
+
</li>
|
420
|
+
|
421
|
+
|
422
|
+
<li class="public ">
|
423
|
+
<span class="summary_signature">
|
424
|
+
|
425
|
+
<a href="#response_parser-class_method" title="response_parser (class method)">+ (Object) <strong>response_parser</strong>(documents) </a>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
</span>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
440
|
+
|
441
|
+
</li>
|
442
|
+
|
443
|
+
|
444
|
+
<li class="public ">
|
445
|
+
<span class="summary_signature">
|
446
|
+
|
447
|
+
<a href="#results_parser-class_method" title="results_parser (class method)">+ (Object) <strong>results_parser</strong>(results) </a>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
</span>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
462
|
+
|
463
|
+
</li>
|
464
|
+
|
465
|
+
|
466
|
+
<li class="public ">
|
467
|
+
<span class="summary_signature">
|
468
|
+
|
469
|
+
<a href="#select_parser-class_method" title="select_parser (class method)">+ (Object) <strong>select_parser</strong>(json) </a>
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
</span>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
484
|
+
|
485
|
+
</li>
|
486
|
+
|
487
|
+
|
488
|
+
<li class="public ">
|
489
|
+
<span class="summary_signature">
|
490
|
+
|
491
|
+
<a href="#separator_parser-class_method" title="separator_parser (class method)">+ (Object) <strong>separator_parser</strong>(json) </a>
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
</span>
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
506
|
+
|
507
|
+
</li>
|
508
|
+
|
509
|
+
|
510
|
+
<li class="public ">
|
511
|
+
<span class="summary_signature">
|
512
|
+
|
513
|
+
<a href="#slices_parser-class_method" title="slices_parser (class method)">+ (Object) <strong>slices_parser</strong>(json) </a>
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
</span>
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
528
|
+
|
529
|
+
</li>
|
530
|
+
|
531
|
+
|
532
|
+
<li class="public ">
|
533
|
+
<span class="summary_signature">
|
534
|
+
|
535
|
+
<a href="#span_parser-class_method" title="span_parser (class method)">+ (Object) <strong>span_parser</strong>(span) </a>
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
</span>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
550
|
+
|
551
|
+
</li>
|
552
|
+
|
553
|
+
|
554
|
+
<li class="public ">
|
555
|
+
<span class="summary_signature">
|
556
|
+
|
557
|
+
<a href="#structured_text_parser-class_method" title="structured_text_parser (class method)">+ (Object) <strong>structured_text_parser</strong>(json) </a>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
</span>
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
572
|
+
|
573
|
+
</li>
|
574
|
+
|
575
|
+
|
576
|
+
<li class="public ">
|
577
|
+
<span class="summary_signature">
|
578
|
+
|
579
|
+
<a href="#text_parser-class_method" title="text_parser (class method)">+ (Object) <strong>text_parser</strong>(json) </a>
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
</span>
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
594
|
+
|
595
|
+
</li>
|
596
|
+
|
597
|
+
|
598
|
+
<li class="public ">
|
599
|
+
<span class="summary_signature">
|
600
|
+
|
601
|
+
<a href="#timestamp_parser-class_method" title="timestamp_parser (class method)">+ (Object) <strong>timestamp_parser</strong>(json) </a>
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
</span>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
616
|
+
|
617
|
+
</li>
|
618
|
+
|
619
|
+
|
620
|
+
<li class="public ">
|
621
|
+
<span class="summary_signature">
|
622
|
+
|
623
|
+
<a href="#web_link_parser-class_method" title="web_link_parser (class method)">+ (Object) <strong>web_link_parser</strong>(json) </a>
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
</span>
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
638
|
+
|
639
|
+
</li>
|
640
|
+
|
641
|
+
|
642
|
+
</ul>
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
<div id="class_method_details" class="method_details_list">
|
648
|
+
<h2>Class Method Details</h2>
|
649
|
+
|
650
|
+
|
651
|
+
<div class="method_details first">
|
652
|
+
<h3 class="signature first" id="color_parser-class_method">
|
653
|
+
|
654
|
+
+ (<tt>Object</tt>) <strong>color_parser</strong>(json)
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
</h3><table class="source_code">
|
661
|
+
<tr>
|
662
|
+
<td>
|
663
|
+
<pre class="lines">
|
664
|
+
|
665
|
+
|
666
|
+
119
|
667
|
+
120
|
668
|
+
121</pre>
|
669
|
+
</td>
|
670
|
+
<td>
|
671
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 119</span>
|
672
|
+
|
673
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_color_parser'>color_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
674
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Color</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='int'>6</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
675
|
+
<span class='kw'>end</span></pre>
|
676
|
+
</td>
|
677
|
+
</tr>
|
678
|
+
</table>
|
679
|
+
</div>
|
680
|
+
|
681
|
+
<div class="method_details ">
|
682
|
+
<h3 class="signature " id="date_parser-class_method">
|
683
|
+
|
684
|
+
+ (<tt>Object</tt>) <strong>date_parser</strong>(json)
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
</h3><table class="source_code">
|
691
|
+
<tr>
|
692
|
+
<td>
|
693
|
+
<pre class="lines">
|
694
|
+
|
695
|
+
|
696
|
+
79
|
697
|
+
80
|
698
|
+
81</pre>
|
699
|
+
</td>
|
700
|
+
<td>
|
701
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 79</span>
|
702
|
+
|
703
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_date_parser'>date_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
704
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
705
|
+
<span class='kw'>end</span></pre>
|
706
|
+
</td>
|
707
|
+
</tr>
|
708
|
+
</table>
|
709
|
+
</div>
|
710
|
+
|
711
|
+
<div class="method_details ">
|
712
|
+
<h3 class="signature " id="document_link_parser-class_method">
|
713
|
+
|
714
|
+
+ (<tt>Object</tt>) <strong>document_link_parser</strong>(json)
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
</h3><table class="source_code">
|
721
|
+
<tr>
|
722
|
+
<td>
|
723
|
+
<pre class="lines">
|
724
|
+
|
725
|
+
|
726
|
+
32
|
727
|
+
33
|
728
|
+
34
|
729
|
+
35
|
730
|
+
36
|
731
|
+
37
|
732
|
+
38
|
733
|
+
39
|
734
|
+
40
|
735
|
+
41
|
736
|
+
42
|
737
|
+
43
|
738
|
+
44
|
739
|
+
45
|
740
|
+
46
|
741
|
+
47
|
742
|
+
48
|
743
|
+
49
|
744
|
+
50
|
745
|
+
51
|
746
|
+
52
|
747
|
+
53</pre>
|
748
|
+
</td>
|
749
|
+
<td>
|
750
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 32</span>
|
751
|
+
|
752
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_document_link_parser'>document_link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
753
|
+
<span class='id identifier rubyid_doc'>doc</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>document</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
754
|
+
<span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
755
|
+
<span class='id identifier rubyid_fragments'>fragments</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
756
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>and</span> <span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span>
|
757
|
+
<span class='id identifier rubyid_fragments'>fragments</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='op'>|</span>
|
758
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
759
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_multiple_parser'>multiple_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
760
|
+
<span class='kw'>else</span>
|
761
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_parsers'>parsers</span><span class='lbracket'>[</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
762
|
+
<span class='kw'>end</span>
|
763
|
+
<span class='rbrace'>}</span><span class='rbracket'>]</span>
|
764
|
+
<span class='kw'>end</span>
|
765
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>DocumentLink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
766
|
+
<span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
767
|
+
<span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>uid</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
768
|
+
<span class='id identifier rubyid_type'>type</span><span class='comma'>,</span>
|
769
|
+
<span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
770
|
+
<span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_unescape'>unescape</span><span class='lparen'>(</span><span class='id identifier rubyid_doc'>doc</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slug</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span>
|
771
|
+
<span class='id identifier rubyid_fragments'>fragments</span><span class='comma'>,</span>
|
772
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>isBroken</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
773
|
+
<span class='kw'>end</span></pre>
|
774
|
+
</td>
|
775
|
+
</tr>
|
776
|
+
</table>
|
777
|
+
</div>
|
778
|
+
|
779
|
+
<div class="method_details ">
|
780
|
+
<h3 class="signature " id="document_parser-class_method">
|
781
|
+
|
782
|
+
+ (<tt>Object</tt>) <strong>document_parser</strong>(json)
|
783
|
+
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
</h3><table class="source_code">
|
789
|
+
<tr>
|
790
|
+
<td>
|
791
|
+
<pre class="lines">
|
792
|
+
|
793
|
+
|
794
|
+
224
|
795
|
+
225
|
796
|
+
226
|
797
|
+
227
|
798
|
+
228
|
799
|
+
229
|
800
|
+
230
|
801
|
+
231
|
802
|
+
232
|
803
|
+
233
|
804
|
+
234
|
805
|
+
235
|
806
|
+
236
|
807
|
+
237
|
808
|
+
238
|
809
|
+
239
|
810
|
+
240
|
811
|
+
241
|
812
|
+
242
|
813
|
+
243
|
814
|
+
244
|
815
|
+
245
|
816
|
+
246
|
817
|
+
247
|
818
|
+
248
|
819
|
+
249</pre>
|
820
|
+
</td>
|
821
|
+
<td>
|
822
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 224</span>
|
823
|
+
|
824
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_document_parser'>document_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
825
|
+
<span class='id identifier rubyid_data_json'>data_json</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='comment'># {"doc_type": data}
|
826
|
+
</span>
|
827
|
+
<span class='comment'># Removing the unknown types + sending a warning, once
|
828
|
+
</span> <span class='id identifier rubyid_data_json'>data_json</span><span class='period'>.</span><span class='id identifier rubyid_select!'>select!</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='op'>|</span>
|
829
|
+
<span class='id identifier rubyid_known_type'>known_type</span> <span class='op'>=</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_parsers'>parsers</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
830
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_known_type'>known_type</span> <span class='op'>&&</span> <span class='op'>!</span><span class='cvar'>@@warned_unknown_type</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
831
|
+
<span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> is unknown, fragment was skipped; perhaps you should update your prismic.io gem?</span><span class='tstring_end'>"</span></span>
|
832
|
+
<span class='cvar'>@@warned_unknown_type</span> <span class='op'><<</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
833
|
+
<span class='kw'>end</span>
|
834
|
+
<span class='id identifier rubyid_known_type'>known_type</span>
|
835
|
+
<span class='rbrace'>}</span>
|
836
|
+
|
837
|
+
<span class='id identifier rubyid_fragments'>fragments</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_data_json'>data_json</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='op'>|</span>
|
838
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment_parser'>fragment_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
839
|
+
<span class='rbrace'>}</span><span class='rbracket'>]</span>
|
840
|
+
|
841
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Document</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
842
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
843
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>uid</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
844
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
845
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>href</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
846
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>tags</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
847
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slugs</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_slug'>slug</span><span class='op'>|</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_unescape'>unescape</span><span class='lparen'>(</span><span class='id identifier rubyid_slug'>slug</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
848
|
+
<span class='id identifier rubyid_fragments'>fragments</span><span class='rparen'>)</span>
|
849
|
+
<span class='kw'>end</span></pre>
|
850
|
+
</td>
|
851
|
+
</tr>
|
852
|
+
</table>
|
853
|
+
</div>
|
854
|
+
|
855
|
+
<div class="method_details ">
|
856
|
+
<h3 class="signature " id="embed_parser-class_method">
|
857
|
+
|
858
|
+
+ (<tt>Object</tt>) <strong>embed_parser</strong>(json)
|
859
|
+
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
|
864
|
+
</h3><table class="source_code">
|
865
|
+
<tr>
|
866
|
+
<td>
|
867
|
+
<pre class="lines">
|
868
|
+
|
869
|
+
|
870
|
+
91
|
871
|
+
92
|
872
|
+
93
|
873
|
+
94
|
874
|
+
95
|
875
|
+
96
|
876
|
+
97
|
877
|
+
98
|
878
|
+
99
|
879
|
+
100</pre>
|
880
|
+
</td>
|
881
|
+
<td>
|
882
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 91</span>
|
883
|
+
|
884
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_embed_parser'>embed_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
885
|
+
<span class='id identifier rubyid_oembed'>oembed</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>oembed</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
886
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Embed</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
887
|
+
<span class='id identifier rubyid_oembed'>oembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
888
|
+
<span class='id identifier rubyid_oembed'>oembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>provider_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
889
|
+
<span class='id identifier rubyid_oembed'>oembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>provider_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
890
|
+
<span class='id identifier rubyid_oembed'>oembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
891
|
+
<span class='id identifier rubyid_oembed'>oembed</span>
|
892
|
+
<span class='rparen'>)</span>
|
893
|
+
<span class='kw'>end</span></pre>
|
894
|
+
</td>
|
895
|
+
</tr>
|
896
|
+
</table>
|
897
|
+
</div>
|
898
|
+
|
899
|
+
<div class="method_details ">
|
900
|
+
<h3 class="signature " id="file_link_parser-class_method">
|
901
|
+
|
902
|
+
+ (<tt>Object</tt>) <strong>file_link_parser</strong>(json)
|
903
|
+
|
904
|
+
|
905
|
+
|
906
|
+
|
907
|
+
|
908
|
+
</h3><table class="source_code">
|
909
|
+
<tr>
|
910
|
+
<td>
|
911
|
+
<pre class="lines">
|
912
|
+
|
913
|
+
|
914
|
+
59
|
915
|
+
60
|
916
|
+
61</pre>
|
917
|
+
</td>
|
918
|
+
<td>
|
919
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 59</span>
|
920
|
+
|
921
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_file_link_parser'>file_link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
922
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>FileLink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>file</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>file</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>file</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>kind</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>file</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>size</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
923
|
+
<span class='kw'>end</span></pre>
|
924
|
+
</td>
|
925
|
+
</tr>
|
926
|
+
</table>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
<div class="method_details ">
|
930
|
+
<h3 class="signature " id="fragment_parser-class_method">
|
931
|
+
|
932
|
+
+ (<tt>Object</tt>) <strong>fragment_parser</strong>(fragment)
|
933
|
+
|
934
|
+
|
935
|
+
|
936
|
+
|
937
|
+
|
938
|
+
</h3><table class="source_code">
|
939
|
+
<tr>
|
940
|
+
<td>
|
941
|
+
<pre class="lines">
|
942
|
+
|
943
|
+
|
944
|
+
216
|
945
|
+
217
|
946
|
+
218
|
947
|
+
219
|
948
|
+
220
|
949
|
+
221
|
950
|
+
222</pre>
|
951
|
+
</td>
|
952
|
+
<td>
|
953
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 216</span>
|
954
|
+
|
955
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fragment_parser'>fragment_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span>
|
956
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
957
|
+
<span class='id identifier rubyid_multiple_parser'>multiple_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span>
|
958
|
+
<span class='kw'>else</span>
|
959
|
+
<span class='id identifier rubyid_parsers'>parsers</span><span class='lbracket'>[</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span>
|
960
|
+
<span class='kw'>end</span>
|
961
|
+
<span class='kw'>end</span></pre>
|
962
|
+
</td>
|
963
|
+
</tr>
|
964
|
+
</table>
|
965
|
+
</div>
|
966
|
+
|
967
|
+
<div class="method_details ">
|
968
|
+
<h3 class="signature " id="geo_point_parser-class_method">
|
969
|
+
|
970
|
+
+ (<tt>Object</tt>) <strong>geo_point_parser</strong>(json)
|
971
|
+
|
972
|
+
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
</h3><table class="source_code">
|
977
|
+
<tr>
|
978
|
+
<td>
|
979
|
+
<pre class="lines">
|
980
|
+
|
981
|
+
|
982
|
+
102
|
983
|
+
103
|
984
|
+
104
|
985
|
+
105
|
986
|
+
106
|
987
|
+
107</pre>
|
988
|
+
</td>
|
989
|
+
<td>
|
990
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 102</span>
|
991
|
+
|
992
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_geo_point_parser'>geo_point_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
993
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>GeoPoint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
994
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>longitude</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
995
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>latitude</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
996
|
+
<span class='rparen'>)</span>
|
997
|
+
<span class='kw'>end</span></pre>
|
998
|
+
</td>
|
999
|
+
</tr>
|
1000
|
+
</table>
|
1001
|
+
</div>
|
1002
|
+
|
1003
|
+
<div class="method_details ">
|
1004
|
+
<h3 class="signature " id="group_parser-class_method">
|
1005
|
+
|
1006
|
+
+ (<tt>Object</tt>) <strong>group_parser</strong>(json)
|
1007
|
+
|
1008
|
+
|
1009
|
+
|
1010
|
+
|
1011
|
+
|
1012
|
+
</h3><table class="source_code">
|
1013
|
+
<tr>
|
1014
|
+
<td>
|
1015
|
+
<pre class="lines">
|
1016
|
+
|
1017
|
+
|
1018
|
+
199
|
1019
|
+
200
|
1020
|
+
201
|
1021
|
+
202
|
1022
|
+
203
|
1023
|
+
204
|
1024
|
+
205
|
1025
|
+
206</pre>
|
1026
|
+
</td>
|
1027
|
+
<td>
|
1028
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 199</span>
|
1029
|
+
|
1030
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_group_parser'>group_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1031
|
+
<span class='id identifier rubyid_fragment_list_array'>fragment_list_array</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1032
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_group'>group</span><span class='op'>|</span>
|
1033
|
+
<span class='id identifier rubyid_fragments'>fragments</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span> <span class='id identifier rubyid_group'>group</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_parsers'>parsers</span><span class='lbracket'>[</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
|
1034
|
+
<span class='id identifier rubyid_fragment_list_array'>fragment_list_array</span> <span class='op'><<</span> <span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>GroupDocument</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_fragments'>fragments</span><span class='rparen'>)</span>
|
1035
|
+
<span class='kw'>end</span>
|
1036
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Group</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment_list_array'>fragment_list_array</span><span class='rparen'>)</span>
|
1037
|
+
<span class='kw'>end</span></pre>
|
1038
|
+
</td>
|
1039
|
+
</tr>
|
1040
|
+
</table>
|
1041
|
+
</div>
|
1042
|
+
|
1043
|
+
<div class="method_details ">
|
1044
|
+
<h3 class="signature " id="image_link_parser-class_method">
|
1045
|
+
|
1046
|
+
+ (<tt>Object</tt>) <strong>image_link_parser</strong>(json)
|
1047
|
+
|
1048
|
+
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
</h3><table class="source_code">
|
1053
|
+
<tr>
|
1054
|
+
<td>
|
1055
|
+
<pre class="lines">
|
1056
|
+
|
1057
|
+
|
1058
|
+
55
|
1059
|
+
56
|
1060
|
+
57</pre>
|
1061
|
+
</td>
|
1062
|
+
<td>
|
1063
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 55</span>
|
1064
|
+
|
1065
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_image_link_parser'>image_link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1066
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>ImageLink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1067
|
+
<span class='kw'>end</span></pre>
|
1068
|
+
</td>
|
1069
|
+
</tr>
|
1070
|
+
</table>
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
<div class="method_details ">
|
1074
|
+
<h3 class="signature " id="image_parser-class_method">
|
1075
|
+
|
1076
|
+
+ (<tt>Object</tt>) <strong>image_parser</strong>(json)
|
1077
|
+
|
1078
|
+
|
1079
|
+
|
1080
|
+
|
1081
|
+
|
1082
|
+
</h3><table class="source_code">
|
1083
|
+
<tr>
|
1084
|
+
<td>
|
1085
|
+
<pre class="lines">
|
1086
|
+
|
1087
|
+
|
1088
|
+
109
|
1089
|
+
110
|
1090
|
+
111
|
1091
|
+
112
|
1092
|
+
113
|
1093
|
+
114
|
1094
|
+
115
|
1095
|
+
116
|
1096
|
+
117</pre>
|
1097
|
+
</td>
|
1098
|
+
<td>
|
1099
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 109</span>
|
1100
|
+
|
1101
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_image_parser'>image_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1102
|
+
<span class='id identifier rubyid_main'>main</span> <span class='op'>=</span> <span class='id identifier rubyid_view_parser'>view_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>main</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1103
|
+
<span class='id identifier rubyid_views'>views</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1104
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>views</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_view'>view</span><span class='op'>|</span>
|
1105
|
+
<span class='id identifier rubyid_views'>views</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_view_parser'>view_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_view'>view</span><span class='rparen'>)</span>
|
1106
|
+
<span class='kw'>end</span>
|
1107
|
+
|
1108
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Image</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_main'>main</span><span class='comma'>,</span> <span class='id identifier rubyid_views'>views</span><span class='rparen'>)</span>
|
1109
|
+
<span class='kw'>end</span></pre>
|
1110
|
+
</td>
|
1111
|
+
</tr>
|
1112
|
+
</table>
|
1113
|
+
</div>
|
1114
|
+
|
1115
|
+
<div class="method_details ">
|
1116
|
+
<h3 class="signature " id="multiple_parser-class_method">
|
1117
|
+
|
1118
|
+
+ (<tt>Object</tt>) <strong>multiple_parser</strong>(json)
|
1119
|
+
|
1120
|
+
|
1121
|
+
|
1122
|
+
|
1123
|
+
|
1124
|
+
</h3><table class="source_code">
|
1125
|
+
<tr>
|
1126
|
+
<td>
|
1127
|
+
<pre class="lines">
|
1128
|
+
|
1129
|
+
|
1130
|
+
192
|
1131
|
+
193
|
1132
|
+
194
|
1133
|
+
195
|
1134
|
+
196
|
1135
|
+
197</pre>
|
1136
|
+
</td>
|
1137
|
+
<td>
|
1138
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 192</span>
|
1139
|
+
|
1140
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_multiple_parser'>multiple_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1141
|
+
<span class='id identifier rubyid_fragments'>fragments</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_fragment'>fragment</span><span class='op'>|</span>
|
1142
|
+
<span class='id identifier rubyid_parsers'>parsers</span><span class='lbracket'>[</span><span class='id identifier rubyid_fragment'>fragment</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_fragment'>fragment</span><span class='rparen'>)</span>
|
1143
|
+
<span class='kw'>end</span>
|
1144
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Multiple</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_fragments'>fragments</span><span class='rparen'>)</span>
|
1145
|
+
<span class='kw'>end</span></pre>
|
1146
|
+
</td>
|
1147
|
+
</tr>
|
1148
|
+
</table>
|
1149
|
+
</div>
|
1150
|
+
|
1151
|
+
<div class="method_details ">
|
1152
|
+
<h3 class="signature " id="number_parser-class_method">
|
1153
|
+
|
1154
|
+
+ (<tt>Object</tt>) <strong>number_parser</strong>(json)
|
1155
|
+
|
1156
|
+
|
1157
|
+
|
1158
|
+
|
1159
|
+
|
1160
|
+
</h3><table class="source_code">
|
1161
|
+
<tr>
|
1162
|
+
<td>
|
1163
|
+
<pre class="lines">
|
1164
|
+
|
1165
|
+
|
1166
|
+
87
|
1167
|
+
88
|
1168
|
+
89</pre>
|
1169
|
+
</td>
|
1170
|
+
<td>
|
1171
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 87</span>
|
1172
|
+
|
1173
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_number_parser'>number_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1174
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Number</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1175
|
+
<span class='kw'>end</span></pre>
|
1176
|
+
</td>
|
1177
|
+
</tr>
|
1178
|
+
</table>
|
1179
|
+
</div>
|
1180
|
+
|
1181
|
+
<div class="method_details ">
|
1182
|
+
<h3 class="signature " id="parsers-class_method">
|
1183
|
+
|
1184
|
+
+ (<tt>Object</tt>) <strong>parsers</strong>
|
1185
|
+
|
1186
|
+
|
1187
|
+
|
1188
|
+
|
1189
|
+
|
1190
|
+
</h3><table class="source_code">
|
1191
|
+
<tr>
|
1192
|
+
<td>
|
1193
|
+
<pre class="lines">
|
1194
|
+
|
1195
|
+
|
1196
|
+
9
|
1197
|
+
10
|
1198
|
+
11
|
1199
|
+
12
|
1200
|
+
13
|
1201
|
+
14
|
1202
|
+
15
|
1203
|
+
16
|
1204
|
+
17
|
1205
|
+
18
|
1206
|
+
19
|
1207
|
+
20
|
1208
|
+
21
|
1209
|
+
22
|
1210
|
+
23
|
1211
|
+
24
|
1212
|
+
25
|
1213
|
+
26
|
1214
|
+
27
|
1215
|
+
28
|
1216
|
+
29
|
1217
|
+
30</pre>
|
1218
|
+
</td>
|
1219
|
+
<td>
|
1220
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 9</span>
|
1221
|
+
|
1222
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parsers'>parsers</span>
|
1223
|
+
<span class='ivar'>@parsers</span> <span class='op'>||=</span> <span class='lbrace'>{</span>
|
1224
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Link.document</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:document_link_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1225
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Text</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:text_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1226
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Link.web</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:web_link_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1227
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Link.image</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:image_link_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1228
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Link.file</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:file_link_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1229
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Date</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:date_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1230
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Timestamp</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:timestamp_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1231
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Number</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:number_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1232
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Embed</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:embed_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1233
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>GeoPoint</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:geo_point_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1234
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Image</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:image_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1235
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Color</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:color_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1236
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>StructuredText</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:structured_text_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1237
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Select</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:select_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1238
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Multiple</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:multiple_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1239
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Group</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:group_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1240
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SliceZone</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:slices_parser</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1241
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Separator</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:separator_parser</span><span class='rparen'>)</span>
|
1242
|
+
<span class='rbrace'>}</span>
|
1243
|
+
<span class='kw'>end</span></pre>
|
1244
|
+
</td>
|
1245
|
+
</tr>
|
1246
|
+
</table>
|
1247
|
+
</div>
|
1248
|
+
|
1249
|
+
<div class="method_details ">
|
1250
|
+
<h3 class="signature " id="response_parser-class_method">
|
1251
|
+
|
1252
|
+
+ (<tt>Object</tt>) <strong>response_parser</strong>(documents)
|
1253
|
+
|
1254
|
+
|
1255
|
+
|
1256
|
+
|
1257
|
+
|
1258
|
+
</h3><div class="docstring">
|
1259
|
+
<div class="discussion">
|
1260
|
+
|
1261
|
+
|
1262
|
+
</div>
|
1263
|
+
</div>
|
1264
|
+
<div class="tags">
|
1265
|
+
|
1266
|
+
<p class="tag_title">Raises:</p>
|
1267
|
+
<ul class="raise">
|
1268
|
+
|
1269
|
+
<li>
|
1270
|
+
|
1271
|
+
|
1272
|
+
<span class='type'>(<tt>FormSearchException</tt>)</span>
|
1273
|
+
|
1274
|
+
|
1275
|
+
|
1276
|
+
</li>
|
1277
|
+
|
1278
|
+
</ul>
|
1279
|
+
|
1280
|
+
</div><table class="source_code">
|
1281
|
+
<tr>
|
1282
|
+
<td>
|
1283
|
+
<pre class="lines">
|
1284
|
+
|
1285
|
+
|
1286
|
+
257
|
1287
|
+
258
|
1288
|
+
259
|
1289
|
+
260
|
1290
|
+
261
|
1291
|
+
262
|
1292
|
+
263
|
1293
|
+
264
|
1294
|
+
265
|
1295
|
+
266
|
1296
|
+
267
|
1297
|
+
268
|
1298
|
+
269</pre>
|
1299
|
+
</td>
|
1300
|
+
<td>
|
1301
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 257</span>
|
1302
|
+
|
1303
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_response_parser'>response_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_documents'>documents</span><span class='rparen'>)</span>
|
1304
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>FormSearchException</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>error</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>error</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1305
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Response</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1306
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>page</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1307
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>results_per_page</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1308
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>results_size</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1309
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>total_results_size</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1310
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>total_pages</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1311
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>next_page</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1312
|
+
<span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>prev_page</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1313
|
+
<span class='id identifier rubyid_results_parser'>results_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_documents'>documents</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>results</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1314
|
+
<span class='rparen'>)</span>
|
1315
|
+
<span class='kw'>end</span></pre>
|
1316
|
+
</td>
|
1317
|
+
</tr>
|
1318
|
+
</table>
|
1319
|
+
</div>
|
1320
|
+
|
1321
|
+
<div class="method_details ">
|
1322
|
+
<h3 class="signature " id="results_parser-class_method">
|
1323
|
+
|
1324
|
+
+ (<tt>Object</tt>) <strong>results_parser</strong>(results)
|
1325
|
+
|
1326
|
+
|
1327
|
+
|
1328
|
+
|
1329
|
+
|
1330
|
+
</h3><table class="source_code">
|
1331
|
+
<tr>
|
1332
|
+
<td>
|
1333
|
+
<pre class="lines">
|
1334
|
+
|
1335
|
+
|
1336
|
+
251
|
1337
|
+
252
|
1338
|
+
253
|
1339
|
+
254
|
1340
|
+
255</pre>
|
1341
|
+
</td>
|
1342
|
+
<td>
|
1343
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 251</span>
|
1344
|
+
|
1345
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_results_parser'>results_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='rparen'>)</span>
|
1346
|
+
<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_doc'>doc</span><span class='op'>|</span>
|
1347
|
+
<span class='id identifier rubyid_document_parser'>document_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_doc'>doc</span><span class='rparen'>)</span>
|
1348
|
+
<span class='kw'>end</span>
|
1349
|
+
<span class='kw'>end</span></pre>
|
1350
|
+
</td>
|
1351
|
+
</tr>
|
1352
|
+
</table>
|
1353
|
+
</div>
|
1354
|
+
|
1355
|
+
<div class="method_details ">
|
1356
|
+
<h3 class="signature " id="select_parser-class_method">
|
1357
|
+
|
1358
|
+
+ (<tt>Object</tt>) <strong>select_parser</strong>(json)
|
1359
|
+
|
1360
|
+
|
1361
|
+
|
1362
|
+
|
1363
|
+
|
1364
|
+
</h3><table class="source_code">
|
1365
|
+
<tr>
|
1366
|
+
<td>
|
1367
|
+
<pre class="lines">
|
1368
|
+
|
1369
|
+
|
1370
|
+
71
|
1371
|
+
72
|
1372
|
+
73</pre>
|
1373
|
+
</td>
|
1374
|
+
<td>
|
1375
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 71</span>
|
1376
|
+
|
1377
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_select_parser'>select_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1378
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Text</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1379
|
+
<span class='kw'>end</span></pre>
|
1380
|
+
</td>
|
1381
|
+
</tr>
|
1382
|
+
</table>
|
1383
|
+
</div>
|
1384
|
+
|
1385
|
+
<div class="method_details ">
|
1386
|
+
<h3 class="signature " id="separator_parser-class_method">
|
1387
|
+
|
1388
|
+
+ (<tt>Object</tt>) <strong>separator_parser</strong>(json)
|
1389
|
+
|
1390
|
+
|
1391
|
+
|
1392
|
+
|
1393
|
+
|
1394
|
+
</h3><table class="source_code">
|
1395
|
+
<tr>
|
1396
|
+
<td>
|
1397
|
+
<pre class="lines">
|
1398
|
+
|
1399
|
+
|
1400
|
+
67
|
1401
|
+
68
|
1402
|
+
69</pre>
|
1403
|
+
</td>
|
1404
|
+
<td>
|
1405
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 67</span>
|
1406
|
+
|
1407
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_separator_parser'>separator_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1408
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Separator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1409
|
+
<span class='kw'>end</span></pre>
|
1410
|
+
</td>
|
1411
|
+
</tr>
|
1412
|
+
</table>
|
1413
|
+
</div>
|
1414
|
+
|
1415
|
+
<div class="method_details ">
|
1416
|
+
<h3 class="signature " id="slices_parser-class_method">
|
1417
|
+
|
1418
|
+
+ (<tt>Object</tt>) <strong>slices_parser</strong>(json)
|
1419
|
+
|
1420
|
+
|
1421
|
+
|
1422
|
+
|
1423
|
+
|
1424
|
+
</h3><table class="source_code">
|
1425
|
+
<tr>
|
1426
|
+
<td>
|
1427
|
+
<pre class="lines">
|
1428
|
+
|
1429
|
+
|
1430
|
+
208
|
1431
|
+
209
|
1432
|
+
210
|
1433
|
+
211
|
1434
|
+
212
|
1435
|
+
213
|
1436
|
+
214</pre>
|
1437
|
+
</td>
|
1438
|
+
<td>
|
1439
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 208</span>
|
1440
|
+
|
1441
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_slices_parser'>slices_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1442
|
+
<span class='id identifier rubyid_slices'>slices</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1443
|
+
<span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
|
1444
|
+
<span class='id identifier rubyid_slices'>slices</span> <span class='op'><<</span> <span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Slice</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='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slice_type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>slice_label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment_parser'>fragment_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1445
|
+
<span class='kw'>end</span>
|
1446
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>SliceZone</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_slices'>slices</span><span class='rparen'>)</span>
|
1447
|
+
<span class='kw'>end</span></pre>
|
1448
|
+
</td>
|
1449
|
+
</tr>
|
1450
|
+
</table>
|
1451
|
+
</div>
|
1452
|
+
|
1453
|
+
<div class="method_details ">
|
1454
|
+
<h3 class="signature " id="span_parser-class_method">
|
1455
|
+
|
1456
|
+
+ (<tt>Object</tt>) <strong>span_parser</strong>(span)
|
1457
|
+
|
1458
|
+
|
1459
|
+
|
1460
|
+
|
1461
|
+
|
1462
|
+
</h3><table class="source_code">
|
1463
|
+
<tr>
|
1464
|
+
<td>
|
1465
|
+
<pre class="lines">
|
1466
|
+
|
1467
|
+
|
1468
|
+
124
|
1469
|
+
125
|
1470
|
+
126
|
1471
|
+
127
|
1472
|
+
128
|
1473
|
+
129
|
1474
|
+
130
|
1475
|
+
131
|
1476
|
+
132
|
1477
|
+
133
|
1478
|
+
134
|
1479
|
+
135
|
1480
|
+
136</pre>
|
1481
|
+
</td>
|
1482
|
+
<td>
|
1483
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 124</span>
|
1484
|
+
|
1485
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span>
|
1486
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1487
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>em</span><span class='tstring_end'>'</span></span>
|
1488
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Em</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1489
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>strong</span><span class='tstring_end'>'</span></span>
|
1490
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Strong</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1491
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hyperlink</span><span class='tstring_end'>'</span></span>
|
1492
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Hyperlink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_link_parser'>link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1493
|
+
<span class='kw'>else</span>
|
1494
|
+
<span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1495
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Label</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
1496
|
+
<span class='kw'>end</span>
|
1497
|
+
<span class='kw'>end</span></pre>
|
1498
|
+
</td>
|
1499
|
+
</tr>
|
1500
|
+
</table>
|
1501
|
+
</div>
|
1502
|
+
|
1503
|
+
<div class="method_details ">
|
1504
|
+
<h3 class="signature " id="structured_text_parser-class_method">
|
1505
|
+
|
1506
|
+
+ (<tt>Object</tt>) <strong>structured_text_parser</strong>(json)
|
1507
|
+
|
1508
|
+
|
1509
|
+
|
1510
|
+
|
1511
|
+
|
1512
|
+
</h3><table class="source_code">
|
1513
|
+
<tr>
|
1514
|
+
<td>
|
1515
|
+
<pre class="lines">
|
1516
|
+
|
1517
|
+
|
1518
|
+
123
|
1519
|
+
124
|
1520
|
+
125
|
1521
|
+
126
|
1522
|
+
127
|
1523
|
+
128
|
1524
|
+
129
|
1525
|
+
130
|
1526
|
+
131
|
1527
|
+
132
|
1528
|
+
133
|
1529
|
+
134
|
1530
|
+
135
|
1531
|
+
136
|
1532
|
+
137
|
1533
|
+
138
|
1534
|
+
139
|
1535
|
+
140
|
1536
|
+
141
|
1537
|
+
142
|
1538
|
+
143
|
1539
|
+
144
|
1540
|
+
145
|
1541
|
+
146
|
1542
|
+
147
|
1543
|
+
148
|
1544
|
+
149
|
1545
|
+
150
|
1546
|
+
151
|
1547
|
+
152
|
1548
|
+
153
|
1549
|
+
154
|
1550
|
+
155
|
1551
|
+
156
|
1552
|
+
157
|
1553
|
+
158
|
1554
|
+
159
|
1555
|
+
160
|
1556
|
+
161
|
1557
|
+
162
|
1558
|
+
163
|
1559
|
+
164
|
1560
|
+
165
|
1561
|
+
166
|
1562
|
+
167
|
1563
|
+
168
|
1564
|
+
169
|
1565
|
+
170
|
1566
|
+
171
|
1567
|
+
172
|
1568
|
+
173
|
1569
|
+
174
|
1570
|
+
175
|
1571
|
+
176
|
1572
|
+
177
|
1573
|
+
178
|
1574
|
+
179
|
1575
|
+
180
|
1576
|
+
181
|
1577
|
+
182
|
1578
|
+
183
|
1579
|
+
184
|
1580
|
+
185
|
1581
|
+
186
|
1582
|
+
187
|
1583
|
+
188
|
1584
|
+
189
|
1585
|
+
190</pre>
|
1586
|
+
</td>
|
1587
|
+
<td>
|
1588
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 123</span>
|
1589
|
+
|
1590
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_structured_text_parser'>structured_text_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1591
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span>
|
1592
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1593
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>em</span><span class='tstring_end'>'</span></span>
|
1594
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Em</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1595
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>strong</span><span class='tstring_end'>'</span></span>
|
1596
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Strong</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1597
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>hyperlink</span><span class='tstring_end'>'</span></span>
|
1598
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Hyperlink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_link_parser'>link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1599
|
+
<span class='kw'>else</span>
|
1600
|
+
<span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1601
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Span</span><span class='op'>::</span><span class='const'>Label</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>start</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>end</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
1602
|
+
<span class='kw'>end</span>
|
1603
|
+
<span class='kw'>end</span>
|
1604
|
+
|
1605
|
+
<span class='id identifier rubyid_blocks'>blocks</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_block'>block</span><span class='op'>|</span>
|
1606
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1607
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>paragraph</span><span class='tstring_end'>'</span></span>
|
1608
|
+
<span class='id identifier rubyid_spans'>spans</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spans</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1609
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>Paragraph</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1610
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>preformatted</span><span class='tstring_end'>'</span></span>
|
1611
|
+
<span class='id identifier rubyid_spans'>spans</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spans</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1612
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>Preformatted</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1613
|
+
<span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^heading(\d+)$</span><span class='regexp_end'>/</span></span>
|
1614
|
+
<span class='id identifier rubyid_heading'>heading</span> <span class='op'>=</span> <span class='backref'>$1</span>
|
1615
|
+
<span class='id identifier rubyid_spans'>spans</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spans</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1616
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>Heading</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1617
|
+
<span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1618
|
+
<span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span>
|
1619
|
+
<span class='id identifier rubyid_heading'>heading</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span>
|
1620
|
+
<span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1621
|
+
<span class='rparen'>)</span>
|
1622
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>o-list-item</span><span class='tstring_end'>'</span></span>
|
1623
|
+
<span class='id identifier rubyid_spans'>spans</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spans</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1624
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>ListItem</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1625
|
+
<span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1626
|
+
<span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span>
|
1627
|
+
<span class='kw'>true</span><span class='comma'>,</span> <span class='comment'># ordered
|
1628
|
+
</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1629
|
+
<span class='rparen'>)</span>
|
1630
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>list-item</span><span class='tstring_end'>'</span></span>
|
1631
|
+
<span class='id identifier rubyid_spans'>spans</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spans</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_span_parser'>span_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1632
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>ListItem</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1633
|
+
<span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1634
|
+
<span class='id identifier rubyid_spans'>spans</span><span class='comma'>,</span>
|
1635
|
+
<span class='kw'>false</span><span class='comma'>,</span> <span class='comment'># unordered
|
1636
|
+
</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1637
|
+
<span class='rparen'>)</span>
|
1638
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image</span><span class='tstring_end'>'</span></span>
|
1639
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='op'>::</span><span class='const'>Block</span><span class='op'>::</span><span class='const'>Image</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1640
|
+
<span class='id identifier rubyid_view_parser'>view_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1641
|
+
<span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>label</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1642
|
+
<span class='rparen'>)</span>
|
1643
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>embed</span><span class='tstring_end'>'</span></span>
|
1644
|
+
<span class='id identifier rubyid_boembed'>boembed</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>oembed</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1645
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Embed</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1646
|
+
<span class='id identifier rubyid_boembed'>boembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1647
|
+
<span class='id identifier rubyid_boembed'>boembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>provider_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1648
|
+
<span class='id identifier rubyid_boembed'>boembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>provider_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1649
|
+
<span class='id identifier rubyid_boembed'>boembed</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>html</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1650
|
+
<span class='id identifier rubyid_boembed'>boembed</span>
|
1651
|
+
<span class='rparen'>)</span>
|
1652
|
+
<span class='kw'>else</span>
|
1653
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown bloc type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1654
|
+
<span class='kw'>end</span>
|
1655
|
+
<span class='kw'>end</span>
|
1656
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>StructuredText</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_blocks'>blocks</span><span class='rparen'>)</span>
|
1657
|
+
<span class='kw'>end</span></pre>
|
1658
|
+
</td>
|
1659
|
+
</tr>
|
1660
|
+
</table>
|
1661
|
+
</div>
|
1662
|
+
|
1663
|
+
<div class="method_details ">
|
1664
|
+
<h3 class="signature " id="text_parser-class_method">
|
1665
|
+
|
1666
|
+
+ (<tt>Object</tt>) <strong>text_parser</strong>(json)
|
1667
|
+
|
1668
|
+
|
1669
|
+
|
1670
|
+
|
1671
|
+
|
1672
|
+
</h3><table class="source_code">
|
1673
|
+
<tr>
|
1674
|
+
<td>
|
1675
|
+
<pre class="lines">
|
1676
|
+
|
1677
|
+
|
1678
|
+
63
|
1679
|
+
64
|
1680
|
+
65</pre>
|
1681
|
+
</td>
|
1682
|
+
<td>
|
1683
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 63</span>
|
1684
|
+
|
1685
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_text_parser'>text_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1686
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Text</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1687
|
+
<span class='kw'>end</span></pre>
|
1688
|
+
</td>
|
1689
|
+
</tr>
|
1690
|
+
</table>
|
1691
|
+
</div>
|
1692
|
+
|
1693
|
+
<div class="method_details ">
|
1694
|
+
<h3 class="signature " id="timestamp_parser-class_method">
|
1695
|
+
|
1696
|
+
+ (<tt>Object</tt>) <strong>timestamp_parser</strong>(json)
|
1697
|
+
|
1698
|
+
|
1699
|
+
|
1700
|
+
|
1701
|
+
|
1702
|
+
</h3><table class="source_code">
|
1703
|
+
<tr>
|
1704
|
+
<td>
|
1705
|
+
<pre class="lines">
|
1706
|
+
|
1707
|
+
|
1708
|
+
83
|
1709
|
+
84
|
1710
|
+
85</pre>
|
1711
|
+
</td>
|
1712
|
+
<td>
|
1713
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 83</span>
|
1714
|
+
|
1715
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_timestamp_parser'>timestamp_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1716
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>Timestamp</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1717
|
+
<span class='kw'>end</span></pre>
|
1718
|
+
</td>
|
1719
|
+
</tr>
|
1720
|
+
</table>
|
1721
|
+
</div>
|
1722
|
+
|
1723
|
+
<div class="method_details ">
|
1724
|
+
<h3 class="signature " id="web_link_parser-class_method">
|
1725
|
+
|
1726
|
+
+ (<tt>Object</tt>) <strong>web_link_parser</strong>(json)
|
1727
|
+
|
1728
|
+
|
1729
|
+
|
1730
|
+
|
1731
|
+
|
1732
|
+
</h3><table class="source_code">
|
1733
|
+
<tr>
|
1734
|
+
<td>
|
1735
|
+
<pre class="lines">
|
1736
|
+
|
1737
|
+
|
1738
|
+
75
|
1739
|
+
76
|
1740
|
+
77</pre>
|
1741
|
+
</td>
|
1742
|
+
<td>
|
1743
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/json_parsers.rb', line 75</span>
|
1744
|
+
|
1745
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_web_link_parser'>web_link_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
1746
|
+
<span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Fragments</span><span class='op'>::</span><span class='const'>WebLink</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>value</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1747
|
+
<span class='kw'>end</span></pre>
|
1748
|
+
</td>
|
1749
|
+
</tr>
|
1750
|
+
</table>
|
1751
|
+
</div>
|
1752
|
+
|
1753
|
+
</div>
|
1754
|
+
|
1755
|
+
</div>
|
1756
|
+
|
1757
|
+
<div id="footer">
|
1758
|
+
Generated on Tue Sep 27 10:47:05 2016 by
|
1759
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1760
|
+
0.8.7.4 (ruby-2.0.0).
|
1761
|
+
</div>
|
1762
|
+
|
1763
|
+
</body>
|
1764
|
+
</html>
|