Class: RailsTableFor::Elements::BlockColumn
- Inherits:
-
Object
- Object
- RailsTableFor::Elements::BlockColumn
- Includes:
- ActionView::Helpers::TagHelper, Column, Helpers::AutoLink
- Defined in:
- lib/rails_table_for/elements/block_column.rb
Instance Method Summary collapse
-
#initialize(block, **options) ⇒ BlockColumn
constructor
A new instance of BlockColumn.
- #td(record) ⇒ Object
Methods included from Column
Methods included from Helpers::AutoLink
Constructor Details
#initialize(block, **options) ⇒ BlockColumn
Returns a new instance of BlockColumn.
16 17 18 19 20 |
# File 'lib/rails_table_for/elements/block_column.rb', line 16 def initialize(block, **) @block = block @title = [:title] @auto_link_enabled = [:auto_link] || false end |
Instance Method Details
#td(record) ⇒ Object
22 23 24 25 26 |
# File 'lib/rails_table_for/elements/block_column.rb', line 22 def td(record) text = block.call(record) content = auto_link_enabled ? auto_link(record, text) : text content_tag :td, content end |