lib/fat_table/column.rb in fat_table-0.3.3 vs lib/fat_table/column.rb in fat_table-0.3.4
- old
+ new
@@ -81,18 +81,18 @@
# nums = [35.25, 18, '35:14', '$18_321']
# col = FatTable::Column.new(header: :prices, items: nums)
# col.type #=> 'Numeric'
# col.header #=> :prices
# col.sum #=> 18376.75
- def initialize(header:, items: [])
+ def initialize(header:, items: [], type: 'NilClass')
@raw_header = header
@header =
if @raw_header.is_a?(Symbol)
@raw_header
else
@raw_header.to_s.as_sym
end
- @type = 'NilClass'
+ @type = type
msg = "unknown column type '#{type}"
raise UserError, msg unless TYPES.include?(@type.to_s)
@items = []
items.each { |i| self << i }