vident 0.2.0 → 0.2.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/lib/vident/base.rb +6 -2
- data/lib/vident/caching/cache_key.rb +3 -7
- data/lib/vident/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: 2279071e93c86a27cab51ac5e30ce0d84ae5696434120043c6a2ebfaab40a4a3
|
|
4
|
+
data.tar.gz: 0e85654cb617dfffdfd42c6263f09c41c20a6d527dfb70d74fc71404b97cda13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 127bf0f2146fed5560fac39c40ec15f967ca55e96af800cb128d1524ed91be7aef13078d070de1b06a7801af32d7f79563a583709dbd0a20e0f72913ea9c0c02
|
|
7
|
+
data.tar.gz: 75aee42b5f6942857bcbd3267914ec3aa031c9a2bfa3ef2b3489f57fde5d172f75508a17b8ce6a89a95791a2b270d182e1194906a1e21eee818ffdc8068f3c70
|
data/lib/vident/base.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Vident
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def identifier_name_path
|
|
36
|
-
if
|
|
36
|
+
if phlex_component?
|
|
37
37
|
name.remove("Views::").underscore
|
|
38
38
|
else
|
|
39
39
|
name.underscore
|
|
@@ -44,6 +44,10 @@ module Vident
|
|
|
44
44
|
path.split("/").map { |p| p.to_s.dasherize }.join("--")
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
def phlex_component?
|
|
48
|
+
@phlex_component ||= ancestors.map(&:name).include?("Phlex::HTML")
|
|
49
|
+
end
|
|
50
|
+
|
|
47
51
|
private
|
|
48
52
|
|
|
49
53
|
# Define reader & presence check method, for performance use ivar directly
|
|
@@ -99,7 +103,7 @@ module Vident
|
|
|
99
103
|
def parent_element(**options)
|
|
100
104
|
@parent_element ||= begin
|
|
101
105
|
# Note: we cant mix phlex and view_component render contexts
|
|
102
|
-
klass = if self.class.
|
|
106
|
+
klass = if self.class.phlex_component?
|
|
103
107
|
RootComponent::UsingPhlexHTML
|
|
104
108
|
else
|
|
105
109
|
RootComponent::UsingViewComponent
|
|
@@ -20,6 +20,9 @@ module Vident
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def with_cache_key(*attrs, name: :_collection)
|
|
23
|
+
raise StandardError, "with_cache_key can only be used on components *without* slots as there is no eary way to track their content changes so too risky" if respond_to?(:slots?) && slots?
|
|
24
|
+
# Add view file to cache key
|
|
25
|
+
attrs << :component_modified_time
|
|
23
26
|
named_cache_key_includes(name, *attrs)
|
|
24
27
|
end
|
|
25
28
|
|
|
@@ -51,13 +54,6 @@ module Vident
|
|
|
51
54
|
|
|
52
55
|
attr_reader :component_dependencies
|
|
53
56
|
|
|
54
|
-
def with_cache_key(*attrs, name: :_collection)
|
|
55
|
-
raise StandardError, "with_cache_key can only be used on components *without* slots as there is no eary way to track their content changes so too risky" if slots?
|
|
56
|
-
# Add view file to cache key
|
|
57
|
-
attrs << :component_modified_time
|
|
58
|
-
super
|
|
59
|
-
end
|
|
60
|
-
|
|
61
57
|
def component_modified_time
|
|
62
58
|
return @component_modified_time if Rails.env.production? && @component_modified_time
|
|
63
59
|
# FIXME: This could stack overflow if there are circular dependencies
|
data/lib/vident/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vident
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Ierodiaconou
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-01-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|