-- cgit v1.2.3 From 2484975e3a56e935b5f24924a6eb048f9fd40ce1 Mon Sep 17 00:00:00 2001 From: ochko Date: Thu, 19 Jan 2012 11:11:55 +0900 Subject: Set default date1904 attribute using platform string --- lib/axlsx/workbook/workbook.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index edb02d81..c5fec5f9 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -89,10 +89,14 @@ require 'axlsx/workbook/worksheet/worksheet.rb' @drawings = SimpleTypedList.new Drawing @charts = SimpleTypedList.new Chart @images = SimpleTypedList.new Pic - self.date1904= options[:date1904] unless options[:date1904].nil? + self.date1904= options[:date1904].nil? ? is_darwin? : options[:date1904] yield self if block_given? end + def is_darwin? + RUBY_PLATFORM.downcase.include?('darwin') + end + # Instance level access to the class variable 1904 # @return [Boolean] def date1904() @@date1904; end -- cgit v1.2.3 From f3ebd7851aa90b3073e181e2cc869f706339c950 Mon Sep 17 00:00:00 2001 From: ochko Date: Thu, 19 Jan 2012 11:54:17 +0900 Subject: date1904 needs to be true on mac and bsd at least --- lib/axlsx/workbook/workbook.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index c5fec5f9..ea733a4f 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -89,12 +89,13 @@ require 'axlsx/workbook/worksheet/worksheet.rb' @drawings = SimpleTypedList.new Drawing @charts = SimpleTypedList.new Chart @images = SimpleTypedList.new Pic - self.date1904= options[:date1904].nil? ? is_darwin? : options[:date1904] + self.date1904= options[:date1904].nil? ? is_bsd? : options[:date1904] yield self if block_given? end - def is_darwin? - RUBY_PLATFORM.downcase.include?('darwin') + def is_bsd? + platform = RUBY_PLATFORM.downcase + platform.include?('freebsd') || platform.include?('darwin') end # Instance level access to the class variable 1904 -- cgit v1.2.3