Sha256: b7afeb9046e0b1dfd7dc4fdd4ef7efff951c1046232280380d2ceb2504dffdd4
Contents?: true
Size: 578 Bytes
Versions: 4
Compression:
Stored size: 578 Bytes
Contents
require 'delegate' module ExcelAbstraction class Date < DelegateClass(Float) ADJUSTMENT = ::Date.parse("1900-03-01") REFERENCE = ::Date.parse("1900-01-01") attr_reader :value def initialize(raw_value) super(convert(raw_value)) end def to_excel_date self end private def reference REFERENCE end def adjustment ADJUSTMENT end def adjust(raw_value) adjustment < raw_value ? 2 : 1 end def convert(raw_value) (raw_value - reference + adjust(raw_value)).to_f end end end
Version data entries
4 entries across 4 versions & 1 rubygems