Sha256: b47b1a46f820ec42b7073446be879e99df0036be738912b70227e9ed864df83b

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

# require "eitil_integrate/application_exporter/auto_sum/format_data"

module EitilIntegrate::RubyXL
  module AutoSum
    class << self

      def format_data
        format_time_strings
        format_ints_to_floats
      end

      # outcommented method in favour of AutoSum#chronic_sum_array: no longer accept days, since the method excepts
      # either hh:mm or hh:mm:ss

      # def format_time_strings
        # @hash.transform_values! { |array| array.map { |item| incomplete_time_string?(item) ? "#{item}:00" : item } }
      # end

      def incomplete_time_string?(string)
        string.is_a?(String) && string.length == 5 && string.scan(/\d{2}:\d{2}/)
      end

      def format_ints_to_floats
        @hash.transform_values! { |array| array.map { |item| item.is_a?(Integer) ? item.to_f : item } }
      end   

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eitil-1.1.4 eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/format_data.rb