class Tabl::Table::Format
Public Class Methods
new(name, table, base)
click to toggle source
# File lib/tabl/table.rb, line 80 def initialize(name, table, base) @name = name @table = table @base = base end
Public Instance Methods
format(key, value, record, context)
click to toggle source
# File lib/tabl/table.rb, line 97 def format(key, value, record, context) column = @table.column(key) if column.formats[@name] column.format(@name, value, record, context) else @base.format(value) end end
values(record, context = nil)
click to toggle source
# File lib/tabl/table.rb, line 86 def values(record, context = nil) @table.keys.map do |key| value = @table.value(key, record) if value format(key, value, record, context) else @base.default_value end end end