# File lib/parseexcel/parseexcel.rb, line 24 def initialize value, format, row, idx @format = format @idx = idx @row = row @value = value @encoding = Spreadsheet.client_encoding end
# File lib/parseexcel/parseexcel.rb, line 31 def date @row.date @idx end
# File lib/parseexcel/parseexcel.rb, line 34 def datetime @row.datetime @idx end
# File lib/parseexcel/parseexcel.rb, line 40 def to_f @value.to_f end
# File lib/parseexcel/parseexcel.rb, line 37 def to_i @value.to_i end
# File lib/parseexcel/parseexcel.rb, line 43 def to_s(target_encoding=nil) if(target_encoding) begin Iconv.new(target_encoding, @encoding).iconv(@value) rescue Iconv.new(target_encoding, 'ascii').iconv(@value.to_s) end else @value.to_s end end
# File lib/parseexcel/parseexcel.rb, line 54 def type if @format && (@format.date? || @format.time?) :date elsif @value.is_a?(Numeric) :numeric else :text end end