Class: Mensa::Table::Component

Inherits:
ApplicationComponent show all
Includes:
Mensa::TablesHelper
Defined in:
app/components/mensa/table/component.rb

Instance Attribute Summary collapse

Attributes inherited from ApplicationComponent

#original_view_context

Instance Method Summary collapse

Methods included from ApplicationHelper

#method_missing, #respond_to_missing?

Constructor Details

#initialize(table_name, params: {}, **options) ⇒ Component

Returns a new instance of Component.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/components/mensa/table/component.rb', line 11

def initialize(table_name, params: {}, **options)
  @params = params
  config = {params: params}
  view_lookup_table = Mensa.for_name(table_name, config)
  view = view_lookup_table.default_system_view

  table_config = (view&.config&.deep_transform_keys(&:to_sym) || {}).merge(config)
  @table = Mensa.for_name(table_name, table_config)
  @table.table_view = view
  @table.original_view_context = options[:original_view_context]
  @table.component = self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mensa::ApplicationHelper

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



9
10
11
# File 'app/components/mensa/table/component.rb', line 9

def params
  @params
end

#tableObject (readonly)

Returns the value of attribute table.



8
9
10
# File 'app/components/mensa/table/component.rb', line 8

def table
  @table
end