lib/tabulatr/renderer/column.rb in tabulatr2-0.9.21 vs lib/tabulatr/renderer/column.rb in tabulatr2-0.9.22
- old
+ new
@@ -57,12 +57,16 @@
def action?() false end
def value_for(record, view)
val = principal_value(record, view)
if self.col_options.format.present?
- Array(val).map do |v|
- format_value(v)
+ if val.respond_to?(:to_ary)
+ val.map do |v|
+ format_value(v, view)
+ end
+ else
+ format_value(val, view)
end
else
val
end
end
@@ -102,10 +106,10 @@
else
:integer
end
end
- def format_value(value)
+ def format_value(value, view)
case self.col_options.format
when Symbol then view.send(col_options.format, value)
when String then col_options.format % value
when Proc then col_options.format.(value)
else value