module Roo::Excelx::Format

Constants

EXCEPTIONAL_FORMATS
STANDARD_FORMATS

Public Instance Methods

_to_type(format) click to toggle source
# File lib/roo/excelx/format.rb, line 48
def _to_type(format)
  format = format.to_s.downcase
  if (type = EXCEPTIONAL_FORMATS[format])
    type
  elsif format.include?('#')
    :float
  elsif format.include?('y') || !format.match(/d+(?![\]])/).nil?
    if format.include?('h') || format.include?('s')
      :datetime
    else
      :date
    end
  elsif format.include?('h') || format.include?('s')
    :time
  elsif format.include?('%')
    :percentage
  else
    :float
  end
end
to_type(format) click to toggle source
# File lib/roo/excelx/format.rb, line 43
def to_type(format)
  @to_type ||= {}
  @to_type[format] ||= _to_type(format)
end