rbexy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f380f26df4a04d8cc73a9a65b5abaad571a32670013eabb3465eaa7f08ab1de4
4
- data.tar.gz: e729b87a8e1ec2918dce115b240bfbea991a11203d73f003a42cccb972544c93
3
+ metadata.gz: de2d3389ec5f783be2e913921071bc0920baa342980360445e5756a8d6cd2d72
4
+ data.tar.gz: 7dfdd99aa0852253e491889010f87c5a2ca828a57b16fe8749d9231135c785a2
5
5
  SHA512:
6
- metadata.gz: 795cead4247e37aed6d803f430318e8cb5f080ee431fc0f2f6820684b211a0a45d58ea9205b2cbd3c9e94dcf2021fe972596bd48109276334a2b32661813c9ef
7
- data.tar.gz: 6ec46d0e829a2d2fb387b45c372cdd2fa5dcb9f04d5e872c8dea637ee9867af964d76eabd1f2b3f83b437db3c4da823359dba0a24bb149d0fae0f3bdfcc15204
6
+ metadata.gz: a6e669a7babe4bb38c7a31be00c0a98d1035c1c7fec980b713a4bb17a2ba461c127745a7b7fee50f6419830eb7e26bf505243662c08245973fac4a3c0ce20dd4
7
+ data.tar.gz: 91c71f51bd42958d86a5584a85a0a634fb35306e95e4a022bc82508c2d5d7cb05df901197d276a870bbcab19b6d1d632a0de4a43518d39f2dd9b00b08559f316
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  spec/dummy/log/
2
+ pkg/
@@ -43,11 +43,10 @@ module Rbexy
43
43
  end
44
44
 
45
45
  def call
46
- old_lookup_context = view_renderer.lookup_context
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
- view_renderer.lookup_context = old_lookup_context
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Rbexy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport