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.2 lib/helpers/time.rb
evertils-0.3.1.3 lib/helpers/time.rb
evertils-0.3.1.2 lib/helpers/time.rb
evertils-0.3.1.1 lib/helpers/time.rb
evertils-0.3.1 lib/helpers/time.rb
evertils-0.3.0 lib/helpers/time.rb
evertils-0.2.9 lib/helpers/time.rb
evertils-0.2.8.2 lib/helpers/time.rb
evertils-0.2.8.1 lib/helpers/time.rb
evertils-0.2.8 lib/helpers/time.rb
evertils-0.2.7.2 lib/helpers/time.rb
evertils-0.2.7.1 lib/helpers/time.rb
evertils-0.2.7 lib/helpers/time.rb
evertils-0.2.6 lib/helpers/time.rb
evertils-0.2.5 lib/helpers/time.rb
evertils-0.2.3 lib/helpers/time.rb
evertils-0.2.2 lib/helpers/time.rb
evertils-0.2.1 lib/helpers/time.rb
evertils-0.2.0 lib/helpers/time.rb