lib/fat_table/column.rb in fat_table-0.6.4 vs lib/fat_table/column.rb in fat_table-0.6.6

- old
+ new

@@ -68,11 +68,11 @@ # treated as nils and do not affect the type of the column. After a # column acquires a type, blank strings are treated as nil values # except in the case of String columns, which retain them a blank # strings. # - # Examples: + # @example # # require 'fat_table' # col = FatTable::Column.new(header: 'date') # col << Date.today - 30 # col << '2017-05-04' @@ -81,10 +81,12 @@ # 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 + # + # @param def initialize(header:, items: [], type: 'NilClass', tolerant: false) @raw_header = header @header = if @raw_header.is_a?(Symbol) @raw_header @@ -151,11 +153,9 @@ # :category: Attributes # Force the column to have String type and then convert all items to # strings. def force_string! - # msg = "Can only force an empty column to String type" - # raise UserError, msg unless empty? @type = 'String' unless empty? @items = items.map(&:to_s) end end