Sha256: 5d1ede754367e7571467c10d5b00215cd27d1de22a22ec242a00b6dde20419d1

Contents?: true

Size: 722 Bytes

Versions: 8

Compression:

Stored size: 722 Bytes

Contents

require 'date'

module Roo
  class Excelx
    class Cell
      class Date < Roo::Excelx::Cell::DateTime
        attr_reader :value, :formula, :format, :cell_type, :cell_value, :coordinate

        attr_reader_with_default default_type: :date

        def initialize(value, formula, excelx_type, style, link, base_date, coordinate)
          # NOTE: Pass all arguments to the parent class, DateTime.
          super
          @format = excelx_type.last
          @value = link ? Roo::Link.new(link, value) : create_date(base_date, value)
        end

        private

        def create_datetime(_,_);  end

        def create_date(base_date, value)
          base_date + value.to_i
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
roo-2.10.1 lib/roo/excelx/cell/date.rb
roo-2.10.0 lib/roo/excelx/cell/date.rb
roo-2.9.0 lib/roo/excelx/cell/date.rb
ruh-roo-3.0.1 lib/roo/excelx/cell/date.rb
roo-2.8.3 lib/roo/excelx/cell/date.rb
roo-2.8.2 lib/roo/excelx/cell/date.rb
roo-2.8.1 lib/roo/excelx/cell/date.rb
roo-2.8.0 lib/roo/excelx/cell/date.rb