Class: Nquery::CardTableComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/nquery/card_table_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

render_in, #render_in

Constructor Details

#initialize(columns:, class: nil, table_class: "nq-table") ⇒ CardTableComponent

Returns a new instance of CardTableComponent.



7
8
9
10
11
# File 'app/components/nquery/card_table_component.rb', line 7

def initialize(columns:, class: nil, table_class: "nq-table")
  @columns = columns
  @html_class = binding.local_variable_get(:class)
  @table_class = table_class
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



5
6
7
# File 'app/components/nquery/card_table_component.rb', line 5

def columns
  @columns
end

#html_classObject (readonly)

Returns the value of attribute html_class.



5
6
7
# File 'app/components/nquery/card_table_component.rb', line 5

def html_class
  @html_class
end

#table_classObject (readonly)

Returns the value of attribute table_class.



5
6
7
# File 'app/components/nquery/card_table_component.rb', line 5

def table_class
  @table_class
end

Instance Method Details

#css_classObject



13
14
15
16
17
# File 'app/components/nquery/card_table_component.rb', line 13

def css_class
  classes = ["nq-card", "nq-card-table"]
  classes << html_class if html_class.present?
  classes.join(" ")
end