Class: Spina::Hooks::PartialComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::Hooks::PartialComponent
- Defined in:
- app/components/spina/hooks/partial_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(plugin:, partial:) ⇒ PartialComponent
constructor
A new instance of PartialComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(plugin:, partial:) ⇒ PartialComponent
Returns a new instance of PartialComponent.
6 7 8 9 |
# File 'app/components/spina/hooks/partial_component.rb', line 6 def initialize(plugin:, partial:) @plugin = plugin @partial = partial end |
Instance Method Details
#call ⇒ Object
11 12 13 |
# File 'app/components/spina/hooks/partial_component.rb', line 11 def call render partial: "spina/admin/hooks/#{@plugin.namespace}/#{@partial}" end |
#render? ⇒ Boolean
15 16 17 |
# File 'app/components/spina/hooks/partial_component.rb', line 15 def render? helpers.lookup_context.exists? "spina/admin/hooks/#{@plugin.namespace}/_#{@partial}" end |