Class: Essence::TableComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/essence/table_component.rb

Defined Under Namespace

Classes: Column

Constant Summary

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#assets_path, assets_path, images_directory

Methods included from Utils

#get_directory_file_names

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #integer_or_fallback

Constructor Details

#initialize(rows: [], **html_options) ⇒ TableComponent

Returns a new instance of TableComponent.



7
8
9
10
11
# File 'app/components/essence/table_component.rb', line 7

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

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



5
6
7
# File 'app/components/essence/table_component.rb', line 5

def columns
  @columns
end

#html_optionsObject (readonly)

Returns the value of attribute html_options.



5
6
7
# File 'app/components/essence/table_component.rb', line 5

def html_options
  @html_options
end

#rowsObject (readonly)

Returns the value of attribute rows.



5
6
7
# File 'app/components/essence/table_component.rb', line 5

def rows
  @rows
end

Instance Method Details

#column(label) ⇒ Object



13
14
15
# File 'app/components/essence/table_component.rb', line 13

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