Class: PandaCms::Admin::TableComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/panda_cms/admin/table_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(term:, rows:) ⇒ TableComponent

Returns a new instance of TableComponent.



8
9
10
11
12
# File 'app/components/panda_cms/admin/table_component.rb', line 8

def initialize(term:, rows:)
  @term = term
  @rows = rows
  @columns = []
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



6
7
8
# File 'app/components/panda_cms/admin/table_component.rb', line 6

def columns
  @columns
end

Instance Method Details

#column(label) ⇒ Object



14
15
16
# File 'app/components/panda_cms/admin/table_component.rb', line 14

def column(label, &)
  @columns << Column.new(label, &)
end