Class: DryCrud::Table::Col
- Inherits:
-
Object
- Object
- DryCrud::Table::Col
- Defined in:
- app/helpers/dry_crud/table/col.rb
Overview
Helper class to store column information.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#content(entry) ⇒ Object
Runs the Col block for the given entry.
-
#html_cell(entry) ⇒ Object
Renders a table cell for the given entry.
-
#html_header ⇒ Object
Renders the header cell of the Col.
-
#initialize(header, html_options, template, block) ⇒ Col
constructor
A new instance of Col.
Constructor Details
#initialize(header, html_options, template, block) ⇒ Col
Returns a new instance of Col.
11 12 13 14 15 16 |
# File 'app/helpers/dry_crud/table/col.rb', line 11 def initialize(header, , template, block) @header = header @html_options = @template = template @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'app/helpers/dry_crud/table/col.rb', line 9 def block @block end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
9 10 11 |
# File 'app/helpers/dry_crud/table/col.rb', line 9 def header @header end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
9 10 11 |
# File 'app/helpers/dry_crud/table/col.rb', line 9 def @html_options end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
9 10 11 |
# File 'app/helpers/dry_crud/table/col.rb', line 9 def template @template end |
Instance Method Details
#content(entry) ⇒ Object
Runs the Col block for the given entry.
19 20 21 |
# File 'app/helpers/dry_crud/table/col.rb', line 19 def content(entry) entry.nil? ? '' : capture(entry, &block) end |
#html_cell(entry) ⇒ Object
Renders a table cell for the given entry.
29 30 31 |
# File 'app/helpers/dry_crud/table/col.rb', line 29 def html_cell(entry) tag.td(content(entry), **) end |
#html_header ⇒ Object
Renders the header cell of the Col.
24 25 26 |
# File 'app/helpers/dry_crud/table/col.rb', line 24 def html_header tag.th(header, **) end |