Method: Workbook::Column#column_type

Defined in:
lib/workbook/column.rb

#column_typeObject

Returns column type, either :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :date, :binary, :boolean



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/workbook/column.rb', line 17

def column_type
  return @column_type if defined?(@column_type)
  ind = self.index
  table[1..500].each do |row|
    if row[ind] and row[ind].cell_type
      cel_column_type = row[ind].cell_type
      if !defined?(@column_type) or @column_type.nil?
        @column_type = cel_column_type
      elsif cel_column_type == @column_type or cel_column_type == :nil
      else
        @column_type = :string
        break
      end
    end
  end
  return @column_type
end