Sha256: 22b8b8d160c6fc95f3bf7c7acba89d352af61cb8b0e78690dd8de48feb379dfe

Contents?: true

Size: 570 Bytes

Versions: 59

Compression:

Stored size: 570 Bytes

Contents

module Evertils
  module Helper
    class Time
      def self.human_readable(start, finish)
        seconds = finish.to_f - start.to_f

        if seconds < 60
          "No time at all!"
        else
          minutes = (seconds / 60).round(1)
          if minutes < 1
            "#{minutes} minute"
          else
            "#{minutes} minutes"
          end
        end
      end

      def self.formatted(time = nil)
        if time.nil?
          time = ::Time.now
        end
        
        time.strftime("%e/%-m/%Y @ %I:%M:%S%P")
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
evertils-0.3.21 lib/evertils/helpers/time.rb
evertils-0.3.20 lib/evertils/helpers/time.rb
evertils-0.3.19 lib/evertils/helpers/time.rb
evertils-0.3.18 lib/evertils/helpers/time.rb
evertils-0.3.17 lib/evertils/helpers/time.rb
evertils-0.3.16 lib/evertils/helpers/time.rb
evertils-0.3.15 lib/evertils/helpers/time.rb
evertils-0.3.14.1 lib/evertils/helpers/time.rb
evertils-0.3.14 lib/evertils/helpers/time.rb
evertils-0.3.13 lib/evertils/helpers/time.rb
evertils-0.3.12 lib/evertils/helpers/time.rb
evertils-0.3.11 lib/evertils/helpers/time.rb
evertils-0.3.10 lib/evertils/helpers/time.rb
evertils-0.3.9 lib/evertils/helpers/time.rb
evertils-0.3.8 lib/evertils/helpers/time.rb
evertils-0.3.7 lib/helpers/time.rb
evertils-0.3.6 lib/helpers/time.rb
evertils-0.3.5 lib/helpers/time.rb
evertils-0.3.4 lib/helpers/time.rb
evertils-0.3.3 lib/helpers/time.rb