class TableData::CoercingRow

Public Class Methods

new(table, index, data, coercions) click to toggle source
Calls superclass method
# File lib/tabledata/coercing_row.rb, line 5
def initialize(table, index, data, coercions)
  @coercions  = coercions
  super(table, index, data.map.with_index { |value, col| coerce(col, value) })
end

Public Instance Methods

coerce(column, value) click to toggle source
# File lib/tabledata/coercing_row.rb, line 10
def coerce(column, value)
  coercer = @coercions[column]
  coercer ? coercer.call(value) : value
end