Class: TableGo::Formatter
- Inherits:
-
Object
- Object
- TableGo::Formatter
show all
- Extended by:
- ActionView::Helpers::NumberHelper
- Defined in:
- lib/table_go/formatter.rb
Defined Under Namespace
Classes: MissingFormatterError
Class Method Summary
collapse
Class Method Details
.apply(formatter, record, column, value) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/table_go/formatter.rb', line 55
def self.apply(formatter, record, column, value)
formatter_proc =
case formatter
when Symbol; formatters[formatter.to_sym]
when Proc; formatter
end
raise MissingFormatterError.new('formatter "%s" not found' % formatter) if formatter_proc.blank?
formatter_proc.call(value, record, column).to_s.html_safe
end
|
.apply_send(formatter, record, column, value) ⇒ Object
66
67
68
|
# File 'lib/table_go/formatter.rb', line 66
def self.apply_send(formatter, record, column, value)
value.send(formatter)
end
|