Parent

Spreadsheet::ParseExcel::Worksheet::Cell

Attributes

annotation[RW]
book[RW]
code[RW]
encoding[RW]
format[RW]
kind[RW]
numeric[RW]
rich[RW]
value[RW]

Public Class Methods

new(value, format, row, idx) click to toggle source
# 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

Public Instance Methods

date() click to toggle source
# File lib/parseexcel/parseexcel.rb, line 31
def date
  @row.date @idx
end
datetime() click to toggle source
# File lib/parseexcel/parseexcel.rb, line 34
def datetime
  @row.datetime @idx
end
to_f() click to toggle source
# File lib/parseexcel/parseexcel.rb, line 40
def to_f
  @value.to_f
end
to_i() click to toggle source
# File lib/parseexcel/parseexcel.rb, line 37
def to_i
  @value.to_i
end
to_s(target_encoding=nil) click to toggle source
# 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
type() click to toggle source
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.