phlex 2.0.0.rc1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phlex/fifo.rb +10 -3
- data/lib/phlex/fifo_cache_store.rb +49 -0
- data/lib/phlex/helpers.rb +1 -1
- data/lib/phlex/html/standard_elements.rb +0 -101
- data/lib/phlex/html/void_elements.rb +0 -11
- data/lib/phlex/html.rb +3 -3
- data/lib/phlex/kit.rb +20 -15
- data/lib/phlex/null_cache_store.rb +9 -0
- data/lib/phlex/sgml/elements.rb +19 -53
- data/lib/phlex/sgml/state.rb +118 -0
- data/lib/phlex/sgml.rb +131 -68
- data/lib/phlex/svg/standard_elements.rb +0 -63
- data/lib/phlex/version.rb +1 -1
- data/lib/phlex.rb +16 -5
- metadata +6 -7
- data/lib/phlex/context.rb +0 -60
@@ -17,7 +17,6 @@ module Phlex::SVG::StandardElements
|
|
17
17
|
**attributes,
|
18
18
|
&content
|
19
19
|
) = nil
|
20
|
-
|
21
20
|
# Outputs an `<animate>` tag.
|
22
21
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/animate
|
23
22
|
register_element def animate(
|
@@ -28,7 +27,6 @@ module Phlex::SVG::StandardElements
|
|
28
27
|
**attributes,
|
29
28
|
&content
|
30
29
|
) = nil
|
31
|
-
|
32
30
|
# Outputs an `<animateMotion>` tag.
|
33
31
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/animateMotion
|
34
32
|
register_element def animateMotion(
|
@@ -54,427 +52,366 @@ module Phlex::SVG::StandardElements
|
|
54
52
|
**attributes,
|
55
53
|
&content
|
56
54
|
) = nil
|
57
|
-
|
58
55
|
# Outputs an `<animateTransform>` tag.
|
59
56
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/animateTransform
|
60
57
|
register_element def animateTransform(
|
61
58
|
**attributes,
|
62
59
|
&content
|
63
60
|
) = nil
|
64
|
-
|
65
61
|
# Outputs a `<circle>` tag.
|
66
62
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/circle
|
67
63
|
register_element def circle(
|
68
64
|
**attributes,
|
69
65
|
&content
|
70
66
|
) = nil
|
71
|
-
|
72
67
|
# Outputs a `<clipPath>` tag.
|
73
68
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/clipPath
|
74
69
|
register_element def clipPath(
|
75
70
|
**attributes,
|
76
71
|
&content
|
77
72
|
) = nil
|
78
|
-
|
79
73
|
# Outputs a `<defs>` tag.
|
80
74
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/defs
|
81
75
|
register_element def defs(
|
82
76
|
**attributes,
|
83
77
|
&content
|
84
78
|
) = nil
|
85
|
-
|
86
79
|
# Outputs a `<desc>` tag.
|
87
80
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/desc
|
88
81
|
register_element def desc(
|
89
82
|
**attributes,
|
90
83
|
&content
|
91
84
|
) = nil
|
92
|
-
|
93
85
|
# Outputs a `<discard>` tag.
|
94
86
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/discard
|
95
87
|
register_element def discard(
|
96
88
|
**attributes,
|
97
89
|
&content
|
98
90
|
) = nil
|
99
|
-
|
100
91
|
# Outputs an `<ellipse>` tag.
|
101
92
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/ellipse
|
102
93
|
register_element def ellipse(
|
103
94
|
**attributes,
|
104
95
|
&content
|
105
96
|
) = nil
|
106
|
-
|
107
97
|
# Outputs an `<feBlend>` tag.
|
108
98
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feBlend
|
109
99
|
register_element def feBlend(
|
110
100
|
**attributes,
|
111
101
|
&content
|
112
102
|
) = nil
|
113
|
-
|
114
103
|
# Outputs an `<feColorMatrix>` tag.
|
115
104
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feColorMatrix
|
116
105
|
register_element def feColorMatrix(
|
117
106
|
**attributes,
|
118
107
|
&content
|
119
108
|
) = nil
|
120
|
-
|
121
109
|
# Outputs an `<feComponentTransfer>` tag.
|
122
110
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feComponentTransfer
|
123
111
|
register_element def feComponentTransfer(
|
124
112
|
**attributes,
|
125
113
|
&content
|
126
114
|
) = nil
|
127
|
-
|
128
115
|
# Outputs an `<feComposite>` tag.
|
129
116
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feComposite
|
130
117
|
register_element def feComposite(
|
131
118
|
**attributes,
|
132
119
|
&content
|
133
120
|
) = nil
|
134
|
-
|
135
121
|
# Outputs an `<feConvolveMatrix>` tag.
|
136
122
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feConvolveMatrix
|
137
123
|
register_element def feConvolveMatrix(
|
138
124
|
**attributes,
|
139
125
|
&content
|
140
126
|
) = nil
|
141
|
-
|
142
127
|
# Outputs an `<feDiffuseLighting>` tag.
|
143
128
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feDiffuseLighting
|
144
129
|
register_element def feDiffuseLighting(
|
145
130
|
**attributes,
|
146
131
|
&content
|
147
132
|
) = nil
|
148
|
-
|
149
133
|
# Outputs an `<feDisplacementMap>` tag.
|
150
134
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feDisplacementMap
|
151
135
|
register_element def feDisplacementMap(
|
152
136
|
**attributes,
|
153
137
|
&content
|
154
138
|
) = nil
|
155
|
-
|
156
139
|
# Outputs an `<feDistantLight>` tag.
|
157
140
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feDistantLight
|
158
141
|
register_element def feDistantLight(
|
159
142
|
**attributes,
|
160
143
|
&content
|
161
144
|
) = nil
|
162
|
-
|
163
145
|
# Outputs an `<feDropShadow>` tag.
|
164
146
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feDropShadow
|
165
147
|
register_element def feDropShadow(
|
166
148
|
**attributes,
|
167
149
|
&content
|
168
150
|
) = nil
|
169
|
-
|
170
151
|
# Outputs an `<feFlood>` tag.
|
171
152
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feFlood
|
172
153
|
register_element def feFlood(
|
173
154
|
**attributes,
|
174
155
|
&content
|
175
156
|
) = nil
|
176
|
-
|
177
157
|
# Outputs an `<feFuncA>` tag.
|
178
158
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncA
|
179
159
|
register_element def feFuncA(
|
180
160
|
**attributes,
|
181
161
|
&content
|
182
162
|
) = nil
|
183
|
-
|
184
163
|
# Outputs an `<feFuncB>` tag.
|
185
164
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncB
|
186
165
|
register_element def feFuncB(
|
187
166
|
**attributes,
|
188
167
|
&content
|
189
168
|
) = nil
|
190
|
-
|
191
169
|
# Outputs an `<feFuncG>` tag.
|
192
170
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncG
|
193
171
|
register_element def feFuncG(
|
194
172
|
**attributes,
|
195
173
|
&content
|
196
174
|
) = nil
|
197
|
-
|
198
175
|
# Outputs an `<feFuncR>` tag.
|
199
176
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feFuncR
|
200
177
|
register_element def feFuncR(
|
201
178
|
**attributes,
|
202
179
|
&content
|
203
180
|
) = nil
|
204
|
-
|
205
181
|
# Outputs an `<feGaussianBlur>` tag.
|
206
182
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feGaussianBlur
|
207
183
|
register_element def feGaussianBlur(
|
208
184
|
**attributes,
|
209
185
|
&content
|
210
186
|
) = nil
|
211
|
-
|
212
187
|
# Outputs an `<feImage>` tag.
|
213
188
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feImage
|
214
189
|
register_element def feImage(
|
215
190
|
**attributes,
|
216
191
|
&content
|
217
192
|
) = nil
|
218
|
-
|
219
193
|
# Outputs an `<feMerge>` tag.
|
220
194
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feMerge
|
221
195
|
register_element def feMerge(
|
222
196
|
**attributes,
|
223
197
|
&content
|
224
198
|
) = nil
|
225
|
-
|
226
199
|
# Outputs an `<feMergeNode>` tag.
|
227
200
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feMergeNode
|
228
201
|
register_element def feMergeNode(
|
229
202
|
**attributes,
|
230
203
|
&content
|
231
204
|
) = nil
|
232
|
-
|
233
205
|
# Outputs an `<feMorphology>` tag.
|
234
206
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feMorphology
|
235
207
|
register_element def feMorphology(
|
236
208
|
**attributes,
|
237
209
|
&content
|
238
210
|
) = nil
|
239
|
-
|
240
211
|
# Outputs an `<feOffset>` tag.
|
241
212
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feOffset
|
242
213
|
register_element def feOffset(
|
243
214
|
**attributes,
|
244
215
|
&content
|
245
216
|
) = nil
|
246
|
-
|
247
217
|
# Outputs an `<fePointLight>` tag.
|
248
218
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/fePointLight
|
249
219
|
register_element def fePointLight(
|
250
220
|
**attributes,
|
251
221
|
&content
|
252
222
|
) = nil
|
253
|
-
|
254
223
|
# Outputs an `<feSpecularLighting>` tag.
|
255
224
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feSpecularLighting
|
256
225
|
register_element def feSpecularLighting(
|
257
226
|
**attributes,
|
258
227
|
&content
|
259
228
|
) = nil
|
260
|
-
|
261
229
|
# Outputs an `<feSpotLight>` tag.
|
262
230
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feSpotLight
|
263
231
|
register_element def feSpotLight(
|
264
232
|
**attributes,
|
265
233
|
&content
|
266
234
|
) = nil
|
267
|
-
|
268
235
|
# Outputs an `<feTile>` tag.
|
269
236
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feTile
|
270
237
|
register_element def feTile(
|
271
238
|
**attributes,
|
272
239
|
&content
|
273
240
|
) = nil
|
274
|
-
|
275
241
|
# Outputs an `<feTurbulence>` tag.
|
276
242
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/feTurbulence
|
277
243
|
register_element def feTurbulence(
|
278
244
|
**attributes,
|
279
245
|
&content
|
280
246
|
) = nil
|
281
|
-
|
282
247
|
# Outputs a `<filter>` tag.
|
283
248
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/filter
|
284
249
|
register_element def filter(
|
285
250
|
**attributes,
|
286
251
|
&content
|
287
252
|
) = nil
|
288
|
-
|
289
253
|
# Outputs a `<foreignObject>` tag.
|
290
254
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/foreignObject
|
291
255
|
register_element def foreignObject(
|
292
256
|
**attributes,
|
293
257
|
&content
|
294
258
|
) = nil
|
295
|
-
|
296
259
|
# Outputs a `<g>` tag.
|
297
260
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/g
|
298
261
|
register_element def g(
|
299
262
|
**attributes,
|
300
263
|
&content
|
301
264
|
) = nil
|
302
|
-
|
303
265
|
# Outputs an `<image>` tag.
|
304
266
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/image
|
305
267
|
register_element def image(
|
306
268
|
**attributes,
|
307
269
|
&content
|
308
270
|
) = nil
|
309
|
-
|
310
271
|
# Outputs a `<line>` tag.
|
311
272
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/line
|
312
273
|
register_element def line(
|
313
274
|
**attributes,
|
314
275
|
&content
|
315
276
|
) = nil
|
316
|
-
|
317
277
|
# Outputs a `<linearGradient>` tag.
|
318
278
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient
|
319
279
|
register_element def linearGradient(
|
320
280
|
**attributes,
|
321
281
|
&content
|
322
282
|
) = nil
|
323
|
-
|
324
283
|
# Outputs a `<marker>` tag.
|
325
284
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/marker
|
326
285
|
register_element def marker(
|
327
286
|
**attributes,
|
328
287
|
&content
|
329
288
|
) = nil
|
330
|
-
|
331
289
|
# Outputs a `<mask>` tag.
|
332
290
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/mask
|
333
291
|
register_element def mask(
|
334
292
|
**attributes,
|
335
293
|
&content
|
336
294
|
) = nil
|
337
|
-
|
338
295
|
# Outputs a `<metadata>` tag.
|
339
296
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/metadata
|
340
297
|
register_element def metadata(
|
341
298
|
**attributes,
|
342
299
|
&content
|
343
300
|
) = nil
|
344
|
-
|
345
301
|
# Outputs an `<mpath>` tag.
|
346
302
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/mpath
|
347
303
|
register_element def mpath(
|
348
304
|
**attributes,
|
349
305
|
&content
|
350
306
|
) = nil
|
351
|
-
|
352
307
|
# Outputs a `<path>` tag.
|
353
308
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/path
|
354
309
|
register_element def path(
|
355
310
|
**attributes,
|
356
311
|
&content
|
357
312
|
) = nil
|
358
|
-
|
359
313
|
# Outputs a `<pattern>` tag.
|
360
314
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/pattern
|
361
315
|
register_element def pattern(
|
362
316
|
**attributes,
|
363
317
|
&content
|
364
318
|
) = nil
|
365
|
-
|
366
319
|
# Outputs a `<polygon>` tag.
|
367
320
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/polygon
|
368
321
|
register_element def polygon(
|
369
322
|
**attributes,
|
370
323
|
&content
|
371
324
|
) = nil
|
372
|
-
|
373
325
|
# Outputs a `<polyline>` tag.
|
374
326
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/polyline
|
375
327
|
register_element def polyline(
|
376
328
|
**attributes,
|
377
329
|
&content
|
378
330
|
) = nil
|
379
|
-
|
380
331
|
# Outputs a `<radialGradient>` tag.
|
381
332
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient
|
382
333
|
register_element def radialGradient(
|
383
334
|
**attributes,
|
384
335
|
&content
|
385
336
|
) = nil
|
386
|
-
|
387
337
|
# Outputs a `<rect>` tag.
|
388
338
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/rect
|
389
339
|
register_element def rect(
|
390
340
|
**attributes,
|
391
341
|
&content
|
392
342
|
) = nil
|
393
|
-
|
394
343
|
# Outputs a `<script>` tag.
|
395
344
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/script
|
396
345
|
register_element def script(
|
397
346
|
**attributes,
|
398
347
|
&content
|
399
348
|
) = nil
|
400
|
-
|
401
349
|
# Outputs a `<set>` tag.
|
402
350
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/set
|
403
351
|
register_element def set(
|
404
352
|
**attributes,
|
405
353
|
&content
|
406
354
|
) = nil
|
407
|
-
|
408
355
|
# Outputs a `<stop>` tag.
|
409
356
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/stop
|
410
357
|
register_element def stop(
|
411
358
|
**attributes,
|
412
359
|
&content
|
413
360
|
) = nil
|
414
|
-
|
415
361
|
# Outputs a `<style>` tag.
|
416
362
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/style
|
417
363
|
register_element def style(
|
418
364
|
**attributes,
|
419
365
|
&content
|
420
366
|
) = nil
|
421
|
-
|
422
367
|
# Outputs an `<svg>` tag.
|
423
368
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/svg
|
424
369
|
register_element def svg(
|
425
370
|
**attributes,
|
426
371
|
&content
|
427
372
|
) = nil
|
428
|
-
|
429
373
|
# Outputs a `<switch>` tag.
|
430
374
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/switch
|
431
375
|
register_element def switch(
|
432
376
|
**attributes,
|
433
377
|
&content
|
434
378
|
) = nil
|
435
|
-
|
436
379
|
# Outputs a `<symbol>` tag.
|
437
380
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/symbol
|
438
381
|
register_element def symbol(
|
439
382
|
**attributes,
|
440
383
|
&content
|
441
384
|
) = nil
|
442
|
-
|
443
385
|
# Outputs a `<text>` tag.
|
444
386
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/text
|
445
387
|
register_element def text(
|
446
388
|
**attributes,
|
447
389
|
&content
|
448
390
|
) = nil
|
449
|
-
|
450
391
|
# Outputs a `<textPath>` tag.
|
451
392
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/textPath
|
452
393
|
register_element def textPath(
|
453
394
|
**attributes,
|
454
395
|
&content
|
455
396
|
) = nil
|
456
|
-
|
457
397
|
# Outputs a `<title>` tag.
|
458
398
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/title
|
459
399
|
register_element def title(
|
460
400
|
**attributes,
|
461
401
|
&content
|
462
402
|
) = nil
|
463
|
-
|
464
403
|
# Outputs a `<tspan>` tag.
|
465
404
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/tspan
|
466
405
|
register_element def tspan(
|
467
406
|
**attributes,
|
468
407
|
&content
|
469
408
|
) = nil
|
470
|
-
|
471
409
|
# Outputs a `<use>` tag.
|
472
410
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/use
|
473
411
|
register_element def use(
|
474
412
|
**attributes,
|
475
413
|
&content
|
476
414
|
) = nil
|
477
|
-
|
478
415
|
# Outputs a `<view>` tag.
|
479
416
|
# See https://developer.mozilla.org/docs/Web/SVG/Element/view
|
480
417
|
register_element def view(
|
data/lib/phlex/version.rb
CHANGED
data/lib/phlex.rb
CHANGED
@@ -5,26 +5,26 @@ require "set"
|
|
5
5
|
|
6
6
|
module Phlex
|
7
7
|
autoload :ArgumentError, "phlex/errors/argument_error"
|
8
|
-
autoload :Vanish, "phlex/vanish"
|
9
8
|
autoload :CSV, "phlex/csv"
|
10
|
-
autoload :Callable, "phlex/callable"
|
11
|
-
autoload :Context, "phlex/context"
|
12
9
|
autoload :DoubleRenderError, "phlex/errors/double_render_error"
|
13
|
-
autoload :Elements, "phlex/elements"
|
14
10
|
autoload :Error, "phlex/error"
|
15
11
|
autoload :FIFO, "phlex/fifo"
|
12
|
+
autoload :FIFOCacheStore, "phlex/fifo_cache_store"
|
16
13
|
autoload :HTML, "phlex/html"
|
17
14
|
autoload :Helpers, "phlex/helpers"
|
18
15
|
autoload :Kit, "phlex/kit"
|
19
16
|
autoload :NameError, "phlex/errors/name_error"
|
17
|
+
autoload :NullCacheStore, "phlex/null_cache_store"
|
20
18
|
autoload :SGML, "phlex/sgml"
|
21
19
|
autoload :SVG, "phlex/svg"
|
20
|
+
autoload :Vanish, "phlex/vanish"
|
22
21
|
|
23
22
|
Escape = ERB::Escape
|
24
|
-
ATTRIBUTE_CACHE = FIFO.new
|
25
23
|
Null = Object.new.freeze
|
26
24
|
|
25
|
+
DEPLOY_KEY = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
27
26
|
CACHED_FILES = Set.new
|
27
|
+
ATTRIBUTE_CACHE = FIFO.new
|
28
28
|
|
29
29
|
def self.__expand_attribute_cache__(file_path)
|
30
30
|
unless CACHED_FILES.include?(file_path)
|
@@ -32,6 +32,17 @@ module Phlex
|
|
32
32
|
Phlex::ATTRIBUTE_CACHE.expand(File.size(file_path))
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
def self.eager_load
|
37
|
+
queue = [self]
|
38
|
+
|
39
|
+
while (mod = queue.shift)
|
40
|
+
mod.constants.each do |const_name|
|
41
|
+
const = mod.const_get(const_name)
|
42
|
+
queue << const if Module === const
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
35
46
|
end
|
36
47
|
|
37
48
|
def 💪
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Drapper
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: A high-performance view framework optimised for fun.
|
14
13
|
email:
|
@@ -20,22 +19,24 @@ files:
|
|
20
19
|
- LICENSE.txt
|
21
20
|
- README.md
|
22
21
|
- lib/phlex.rb
|
23
|
-
- lib/phlex/context.rb
|
24
22
|
- lib/phlex/csv.rb
|
25
23
|
- lib/phlex/error.rb
|
26
24
|
- lib/phlex/errors/argument_error.rb
|
27
25
|
- lib/phlex/errors/double_render_error.rb
|
28
26
|
- lib/phlex/errors/name_error.rb
|
29
27
|
- lib/phlex/fifo.rb
|
28
|
+
- lib/phlex/fifo_cache_store.rb
|
30
29
|
- lib/phlex/helpers.rb
|
31
30
|
- lib/phlex/html.rb
|
32
31
|
- lib/phlex/html/standard_elements.rb
|
33
32
|
- lib/phlex/html/void_elements.rb
|
34
33
|
- lib/phlex/kit.rb
|
34
|
+
- lib/phlex/null_cache_store.rb
|
35
35
|
- lib/phlex/sgml.rb
|
36
36
|
- lib/phlex/sgml/elements.rb
|
37
37
|
- lib/phlex/sgml/safe_object.rb
|
38
38
|
- lib/phlex/sgml/safe_value.rb
|
39
|
+
- lib/phlex/sgml/state.rb
|
39
40
|
- lib/phlex/svg.rb
|
40
41
|
- lib/phlex/svg/standard_elements.rb
|
41
42
|
- lib/phlex/testing.rb
|
@@ -54,7 +55,6 @@ metadata:
|
|
54
55
|
changelog_uri: https://github.com/phlex-ruby/phlex/blob/main/CHANGELOG.md
|
55
56
|
funding_uri: https://github.com/sponsors/joeldrapper
|
56
57
|
rubygems_mfa_required: 'true'
|
57
|
-
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|
60
60
|
- lib
|
@@ -69,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
73
|
-
signing_key:
|
72
|
+
rubygems_version: 3.6.2
|
74
73
|
specification_version: 4
|
75
74
|
summary: A fun framework for building views in Ruby.
|
76
75
|
test_files: []
|
data/lib/phlex/context.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# @api private
|
4
|
-
class Phlex::Context
|
5
|
-
def initialize(user_context: {}, view_context: nil)
|
6
|
-
@buffer = +""
|
7
|
-
@capturing = false
|
8
|
-
@user_context = user_context
|
9
|
-
@fragments = nil
|
10
|
-
@in_target_fragment = false
|
11
|
-
@halt_signal = nil
|
12
|
-
@view_context = view_context
|
13
|
-
end
|
14
|
-
|
15
|
-
attr_accessor :buffer, :capturing, :user_context, :in_target_fragment
|
16
|
-
|
17
|
-
attr_reader :fragments, :view_context
|
18
|
-
|
19
|
-
def target_fragments(fragments)
|
20
|
-
@fragments = fragments.to_h { |it| [it, true] }
|
21
|
-
end
|
22
|
-
|
23
|
-
def around_render
|
24
|
-
return yield if !@fragments || @halt_signal
|
25
|
-
|
26
|
-
catch do |signal|
|
27
|
-
@halt_signal = signal
|
28
|
-
yield
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def begin_target(id)
|
33
|
-
@in_target_fragment = id
|
34
|
-
end
|
35
|
-
|
36
|
-
def end_target
|
37
|
-
@fragments.delete(@in_target_fragment)
|
38
|
-
@in_target_fragment = false
|
39
|
-
throw @halt_signal if @fragments.length == 0
|
40
|
-
end
|
41
|
-
|
42
|
-
def capturing_into(new_buffer)
|
43
|
-
original_buffer = @buffer
|
44
|
-
original_capturing = @capturing
|
45
|
-
original_fragments = @fragments
|
46
|
-
|
47
|
-
begin
|
48
|
-
@buffer = new_buffer
|
49
|
-
@capturing = true
|
50
|
-
@fragments = nil
|
51
|
-
yield
|
52
|
-
ensure
|
53
|
-
@buffer = original_buffer
|
54
|
-
@capturing = original_capturing
|
55
|
-
@fragments = original_fragments
|
56
|
-
end
|
57
|
-
|
58
|
-
new_buffer
|
59
|
-
end
|
60
|
-
end
|