diff --git a/comma.gemspec b/comma.gemspec index 784c2ab..7d950ed 100644 --- a/comma.gemspec +++ b/comma.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.licenses = ['MIT'] - s.add_dependency 'activesupport', ['>= 4.2.0', '< 6.1'] + s.add_dependency 'activesupport', ['>= 4.2.0', '< 9'] s.add_development_dependency 'appraisal', ['~> 1.0.0'] s.add_development_dependency 'rake', ['~> 10.5.0'] diff --git a/lib/comma/generator.rb b/lib/comma/generator.rb index 7093871..e2f9134 100644 --- a/lib/comma/generator.rb +++ b/lib/comma/generator.rb @@ -31,7 +31,7 @@ def run(iterator_method) def append_csv(csv, iterator_method) return '' if @instance.empty? - csv << @instance.first.to_comma_headers(@style, @globals) unless + csv << @instance.take(1).first.to_comma_headers(@style, @globals) unless @options.key?(:write_headers) && !@options[:write_headers] @instance.send(iterator_method) do |object| csv << object.to_comma(@style, @sanitized, @globals) diff --git a/lib/comma/sanitized_extractor.rb b/lib/comma/sanitized_extractor.rb index df0d3f7..41a6d4e 100644 --- a/lib/comma/sanitized_extractor.rb +++ b/lib/comma/sanitized_extractor.rb @@ -46,7 +46,12 @@ def starts_with_special_characters(result) end def sanitize_result(result) - result = result.to_s + if result.is_a?(ActiveSupport::TimeWithZone) + result = result.to_fs + else + result = result.to_s + end + if starts_with_special_characters(result) if check_for_only_digits(result) result diff --git a/lib/comma/version.rb b/lib/comma/version.rb index 3200635..8f7d736 100644 --- a/lib/comma/version.rb +++ b/lib/comma/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Comma - VERSION = '4.3.2' + VERSION = '4.3.3' end