Class: TableHelper::CallbackColumn
- Defined in:
- lib/table_for/callback_column.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Column
Instance Method Summary collapse
- #content_for(record) ⇒ Object
-
#initialize(template, obj, ops) ⇒ CallbackColumn
constructor
A new instance of CallbackColumn.
Methods inherited from Column
Constructor Details
#initialize(template, obj, ops) ⇒ CallbackColumn
Returns a new instance of CallbackColumn.
3 4 5 6 |
# File 'lib/table_for/callback_column.rb', line 3 def initialize(template, obj, ops) super @callback = .delete(:callback) end |
Instance Method Details
#content_for(record) ⇒ Object
8 9 10 |
# File 'lib/table_for/callback_column.rb', line 8 def content_for(record) @attr ? @callback.call(record.send(@attr).to_s) : @callback.call(record) end |