Class: Spina::Hooks::HookComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(partial:) ⇒ HookComponent

Returns a new instance of HookComponent.



4
5
6
# File 'app/components/spina/hooks/hook_component.rb', line 4

def initialize(partial:)
  @partial = partial
end

Instance Method Details

#callObject



8
9
10
# File 'app/components/spina/hooks/hook_component.rb', line 8

def call
  render Spina::Hooks::PartialComponent.with_collection(plugins, partial: @partial)
end

#pluginsObject



12
13
14
15
16
# File 'app/components/spina/hooks/hook_component.rb', line 12

def plugins
  Spina::Plugin.all.find_all do |plugin|
    helpers.current_theme.plugins.include?(plugin.name)
  end
end