Class: TableHelper::CallbackColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/table_for/callback_column.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Column

#html, #title

Instance Method Summary collapse

Methods inherited from Column

#draw_title

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 = @options.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