phlex 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/phlex/sgml.rb +15 -3
- data/lib/phlex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e84eae72307b1f6e6bf3337cd74d1208d3c2fb58f11e7c08eaf6dd0272fbc702
|
4
|
+
data.tar.gz: a2edd58bd5a1c5185bf9b4222cb0f674fcd488243b4a33c140c92577cd74cbb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c542f19b5121666bca2f3bf661ff05488c21d5b593578f704dbe9f69643d48b839deddd9898214638a21dc7fb9de56dcb750f7401082710a13a5544668a643
|
7
|
+
data.tar.gz: a81c55fb957fa70907fac519b08c072521701908385227f93284219de34e0338a48276faff36ef54ba60d552511a579a734725fcbfea7b6d302edbaaf9e94c54
|
data/README.md
CHANGED
data/lib/phlex/sgml.rb
CHANGED
@@ -56,8 +56,6 @@ class Phlex::SGML
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def internal_call(parent: nil, state: nil, &block)
|
59
|
-
return "" unless render?
|
60
|
-
|
61
59
|
if @_state
|
62
60
|
raise Phlex::DoubleRenderError.new(
|
63
61
|
"You can't render a #{self.class.name} more than once."
|
@@ -66,6 +64,8 @@ class Phlex::SGML
|
|
66
64
|
|
67
65
|
@_state = state
|
68
66
|
|
67
|
+
return "" unless render?
|
68
|
+
|
69
69
|
block ||= @_content_block
|
70
70
|
|
71
71
|
Thread.current[:__phlex_component__] = [self, Fiber.current.object_id].freeze
|
@@ -94,7 +94,19 @@ class Phlex::SGML
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def context
|
97
|
-
|
97
|
+
if rendering?
|
98
|
+
@_state.user_context
|
99
|
+
else
|
100
|
+
raise Phlex::ArgumentError.new(<<~MESSAGE)
|
101
|
+
You can’t access the context before the component has started rendering.
|
102
|
+
MESSAGE
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Returns `false` before rendering and `true` once the component has started rendering.
|
107
|
+
# It will not reset back to false after rendering.
|
108
|
+
def rendering?
|
109
|
+
!!@_state
|
98
110
|
end
|
99
111
|
|
100
112
|
# Output plain text.
|
data/lib/phlex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Drapper
|
8
8
|
- Will Cosgrove
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build HTML & SVG view components with Ruby classes.
|
14
14
|
email:
|