rbexy 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/lib/rbexy/component.rb +16 -9
- data/lib/rbexy/configuration.rb +0 -5
- data/lib/rbexy/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: de2d3389ec5f783be2e913921071bc0920baa342980360445e5756a8d6cd2d72
|
4
|
+
data.tar.gz: 7dfdd99aa0852253e491889010f87c5a2ca828a57b16fe8749d9231135c785a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e669a7babe4bb38c7a31be00c0a98d1035c1c7fec980b713a4bb17a2ba461c127745a7b7fee50f6419830eb7e26bf505243662c08245973fac4a3c0ce20dd4
|
7
|
+
data.tar.gz: 91c71f51bd42958d86a5584a85a0a634fb35306e95e4a022bc82508c2d5d7cb05df901197d276a870bbcab19b6d1d632a0de4a43518d39f2dd9b00b08559f316
|
data/.gitignore
CHANGED
data/lib/rbexy/component.rb
CHANGED
@@ -43,11 +43,10 @@ module Rbexy
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def call
|
46
|
-
|
47
|
-
view_renderer.lookup_context = build_lookup_context(old_lookup_context)
|
46
|
+
replace_lookup_context
|
48
47
|
view_renderer.render(self, partial: component_name, &nil)
|
49
48
|
ensure
|
50
|
-
|
49
|
+
restore_lookup_context
|
51
50
|
end
|
52
51
|
|
53
52
|
def content
|
@@ -67,18 +66,26 @@ module Rbexy
|
|
67
66
|
|
68
67
|
private
|
69
68
|
|
70
|
-
attr_reader :view_context, :content_block
|
69
|
+
attr_reader :view_context, :content_block, :old_lookup_context
|
70
|
+
|
71
|
+
def replace_lookup_context
|
72
|
+
return if view_renderer.lookup_context.is_a? Rbexy::Component::LookupContext
|
73
|
+
@old_lookup_context = view_renderer.lookup_context
|
74
|
+
view_renderer.lookup_context = build_lookup_context(old_lookup_context)
|
75
|
+
end
|
76
|
+
|
77
|
+
def restore_lookup_context
|
78
|
+
return unless old_lookup_context
|
79
|
+
view_renderer.lookup_context = old_lookup_context
|
80
|
+
@old_lookup_context = nil
|
81
|
+
end
|
71
82
|
|
72
83
|
def build_lookup_context(existing_context)
|
73
84
|
paths = existing_context.view_paths.dup.unshift(
|
74
85
|
*Rbexy.configuration.template_paths.map { |p| ActionView::OptimizedFileSystemResolver.new(p) }
|
75
86
|
)
|
76
87
|
|
77
|
-
LookupContext.new(
|
78
|
-
paths,
|
79
|
-
LookupContext.details_hash(existing_context),
|
80
|
-
Rbexy.configuration.template_prefixes
|
81
|
-
)
|
88
|
+
LookupContext.new(paths, LookupContext.details_hash(existing_context))
|
82
89
|
end
|
83
90
|
|
84
91
|
def view_renderer
|
data/lib/rbexy/configuration.rb
CHANGED
@@ -2,14 +2,9 @@ module Rbexy
|
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :component_provider
|
4
4
|
attr_accessor :template_paths
|
5
|
-
attr_accessor :template_prefixes
|
6
5
|
|
7
6
|
def template_paths
|
8
7
|
@template_paths ||= []
|
9
8
|
end
|
10
|
-
|
11
|
-
def template_prefixes
|
12
|
-
@template_prefixes ||= []
|
13
|
-
end
|
14
9
|
end
|
15
10
|
end
|
data/lib/rbexy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbexy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Giancola
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|