module XLSX class Cell # :nodoc: STYLES = {'Default' => '1', 'Result' => '2', 'Result2' => '3', 'Heading' => '4', 'Heading1' => '5'} def self.type_of(value) return 's' if value.is_a? String return 'n' if value.is_a? Integer return 'n' if value.respond_to? :to_i return 's' if value.respond_to? :to_s return 's' # default end def self.storage_hash(row, column) Digest::SHA1.hexdigest("#{row}-#{column}") end attr_accessor :sheet, :type, :value, :style, :row, :column def initialize(sheet, row, column) @sheet, @row, @column = sheet, row.to_i, column.to_i end def storage_hash @storage_hash ||= self.class.storage_hash(row, column) end def <=>(other) return(0) unless other.is_a?(::XLSX::Cell) order = (self.row <=> other.row) order = (self.column <=> other.column) if order == 0 order rescue 0 end end end