Method: FatTable::Column#count

Defined in:
lib/fat_table/column.rb

#countObject

Return a count of the non-nil items in the Column, or the size of the column if all items are nil. Works with any Column type.



230
231
232
233
234
235
236
237
238
# File 'lib/fat_table/column.rb', line 230

def count
  return items.size if items.all?(&:nil?)

  if type == 'String'
    items.count { |i| !i.blank? }
  else
    items.filter_to_type(type).count.to_d
  end
end