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-1.0.12 lib/evertils/helpers/time.rb
evertils-1.0.11 lib/evertils/helpers/time.rb
evertils-1.0.10 lib/evertils/helpers/time.rb
evertils-1.0.9 lib/evertils/helpers/time.rb
evertils-1.0.8 lib/evertils/helpers/time.rb
evertils-1.0.7 lib/evertils/helpers/time.rb
evertils-1.0.6 lib/evertils/helpers/time.rb
evertils-1.0.5 lib/evertils/helpers/time.rb
evertils-1.0.4 lib/evertils/helpers/time.rb
evertils-1.0.3 lib/evertils/helpers/time.rb
evertils-1.0.2 lib/evertils/helpers/time.rb
evertils-1.0.1 lib/evertils/helpers/time.rb
evertils-1.0.0 lib/evertils/helpers/time.rb
evertils-0.4.0 lib/evertils/helpers/time.rb
evertils-0.3.27 lib/evertils/helpers/time.rb
evertils-0.3.26 lib/evertils/helpers/time.rb
evertils-0.3.25 lib/evertils/helpers/time.rb
evertils-0.3.24 lib/evertils/helpers/time.rb
evertils-0.3.23 lib/evertils/helpers/time.rb
evertils-0.3.22 lib/evertils/helpers/time.rb