Sha256: 36d0fd3b513bcf13ca46aef698206103095814223c3baee7aa91912a4d7644ed

Contents?: true

Size: 542 Bytes

Versions: 7

Compression:

Stored size: 542 Bytes

Contents

module Resque
  module History
    module Helper

      def format_execution(seconds)
        if seconds.nil?
          ""
        elsif seconds < 60
          "#{seconds} secs"
        elsif seconds < 60 * 60
          "#{(seconds/60).to_i} minutes"
        elsif seconds < 60 * 60 * 24
          "#{(((seconds.to_f/60/60)*100).truncate.to_f)/100} hours"
        elsif seconds < 60 * 60 * 24 * 7
          "#{(((seconds.to_f/60/60/24)*100).truncate.to_f)/100} days"
        else
          "too long"
        end
      end

    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-history-1.9.5 lib/resque-history/helpers/helper.rb
resque-history-1.9.4 lib/resque-history/helpers/helper.rb
resque-history-1.9.3 lib/resque-history/helpers/helper.rb
resque-history-1.9.2 lib/resque-history/helpers/helper.rb
resque-history-1.9.1 lib/resque-history/helpers/helper.rb
resque-history-1.9.0 lib/resque-history/helpers/helper.rb
resque-history-1.8.2 lib/resque-history/helpers/helper.rb