rbexy 0.2.0 → 0.2.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: 563f7d14586235a18249e38e8859824b7952617b4984ab794e69963c218b41b2
4
- data.tar.gz: a20d77a9a3d2fc439d425033fcb3230d18f59a98990a50be022569de163e67cf
3
+ metadata.gz: 4cf2789f8c063a3b67dc6c4da86979b89214679833c8be14bee61d52b1a17f3b
4
+ data.tar.gz: 89d4d684fb473837be4b7c239e034ec6d27f9b754978cb6bfeb7b77774310e9b
5
5
  SHA512:
6
- metadata.gz: 48a530ceee5c8b30f7c41900db8b5b0658351a5ab397af004bc9b38c1047d1bb62eecc0ee4807bc992d690d50dabf5d291a15aadc7c27975cc6901bae8985ec1
7
- data.tar.gz: 4e5713408292969214aeb92909f522dd59f823f847ece59bb016e55e0993eb2d3c51fd0434ebaab3447f939f32833600da4c466fdacb5d3632b4201dea7c7e13
6
+ metadata.gz: cf0cd9cbf4fc983f6f7213da1babd5e6e334f86c3bd9a3f129f4889d69390946e858a29bc9cede2ffe36e510c6573fea1eb8e55b2e1f504964305a765efd3236
7
+ data.tar.gz: fc8090cb79071025b6f3ab491bdff3558a22dccfe43350830f36e6a8ba965e318b39e86bd07aec73659db428a4c223a115ccb3684b30a819e7dc5b577951d04b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbexy (0.2.0)
4
+ rbexy (0.2.1)
5
5
  actionview (>= 5.0, < 7.0)
6
6
  activesupport (>= 5.0, < 7.0)
7
7
  railties (>= 5.0, < 7.0)
@@ -3,6 +3,8 @@ require "action_view"
3
3
  module Rbexy
4
4
  class Component < ActionView::Base
5
5
  class LookupContext < ActionView::LookupContext
6
+ attr_accessor :component_name_stack
7
+
6
8
  def self.details_hash(context)
7
9
  context.registered_details.each_with_object({}) do |key, details_hash|
8
10
  value = key == :locale ? [context.locale] : context.send(key)
@@ -15,7 +17,8 @@ module Rbexy
15
17
  # template path, since we're using the Rails partial-rendering
16
18
  # functionality but don't want our templates prefixed with a `_`
17
19
  def args_for_lookup(name, prefixes, partial, keys, details_options)
18
- super(name, prefixes, false, keys, details_options)
20
+ partial = false if component_name_stack.include?(name)
21
+ super(name, prefixes, partial, keys, details_options)
19
22
  end
20
23
  end
21
24
 
@@ -77,9 +80,12 @@ module Rbexy
77
80
  attr_reader :view_context, :content_block, :old_lookup_context
78
81
 
79
82
  def replace_lookup_context
80
- return if view_renderer.lookup_context.is_a? Rbexy::Component::LookupContext
81
- @old_lookup_context = view_renderer.lookup_context
82
- view_renderer.lookup_context = build_lookup_context(old_lookup_context)
83
+ unless view_renderer.lookup_context.is_a? Rbexy::Component::LookupContext
84
+ @old_lookup_context = view_renderer.lookup_context
85
+ view_renderer.lookup_context = build_lookup_context(old_lookup_context)
86
+ end
87
+
88
+ (view_renderer.lookup_context.component_name_stack ||= []) << component_name
83
89
  end
84
90
 
85
91
  def restore_lookup_context
@@ -1,3 +1,3 @@
1
1
  module Rbexy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.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.2.0
4
+ version: 0.2.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-13 00:00:00.000000000 Z
11
+ date: 2020-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport