Class: Koi::Header::IndexComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/koi/header/index_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, title: model.model_name.human.pluralize) ⇒ IndexComponent

Returns a new instance of IndexComponent.



10
11
12
13
14
15
16
# File 'app/components/koi/header/index_component.rb', line 10

def initialize(model:, title: model.model_name.human.pluralize)
  super

  @header = HeaderComponent.new(title:)
  @model  = model
  @title  = title
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



6
7
8
# File 'app/components/koi/header/index_component.rb', line 6

def model
  @model
end

Instance Method Details

#callObject



18
19
20
# File 'app/components/koi/header/index_component.rb', line 18

def call
  render @header.with_content(content || "")
end