Sha256: b105818771c0fbf31add8f4157b5ec708e267d63f94d1599cd2300affd147119
Contents?: true
Size: 1.1 KB
Versions: 70
Compression:
Stored size: 1.1 KB
Contents
# require "eitil_integrate/application_exporter/helpers" require "eitil_integrate/application_exporter/initialize" module EitilIntegrate::RubyXL class ApplicationExporter def array_to_indexed_hash(array) array = array_nils_substituted(array) array = array_values_strf(array) array.flatten.map.with_index { |item, index| { "#{index}": item } }.inject &:merge end def array_nils_substituted(array) array.map { |value| value || '' } end def array_values_strf(array) array.map &:to_s end def sanitize_int(integer) (integer.nan? || integer.infinite?) ? 0 : integer end def pretty_date_range date_range.to_s.gsub '..', ' – ' end def strf_date_range date_range.map &:to_s end def double_digit_time(time) time.to_s.length == 1 ? "0#{time}" : time.to_s end def format_minutes(minutes) hours = double_digit_time(minutes / 60) minutes = double_digit_time(minutes % 60) "#{hours}:#{minutes}" end def name_sheet(name='Worksheet') sheet.sheet_name = name end end end
Version data entries
70 entries across 70 versions & 1 rubygems