Class: Spina::Hooks::PartialComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/spina/hooks/partial_component.rb

Instance Method Summary collapse

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

#callObject



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

Returns:

  • (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