Sha256: 52be908b465deb53f0562f68e27992350a62acb6b4f8afdcf5c69e7e541cc269

Contents?: true

Size: 568 Bytes

Versions: 31

Compression:

Stored size: 568 Bytes

Contents

module Granify
  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

31 entries across 31 versions & 2 rubygems

Version Path
evertils-0.1.20 lib/helpers/time.rb
evertils-0.1.19 lib/helpers/time.rb
evertils-0.1.18 lib/helpers/time.rb
evertils-0.1.17 lib/helpers/time.rb
evertils-0.1.15 lib/helpers/time.rb
evertils-0.1.14 lib/helpers/time.rb
evertils-0.1.13 lib/helpers/time.rb
evertils-0.1.12 lib/helpers/time.rb
evertils-0.1.11 lib/helpers/time.rb
evertils-0.1.9 lib/helpers/time.rb
evertils-0.1.8 lib/helpers/time.rb
evertils-0.1.7 lib/helpers/time.rb
evertils-0.1.6 lib/helpers/time.rb
evertils-0.1.5 lib/helpers/time.rb
evertils-0.1.4 lib/helpers/time.rb
evertils-0.1.3 lib/helpers/time.rb
evertils-0.1.2 lib/helpers/time.rb
evertils-0.1.1 lib/helpers/time.rb
evertils-0.1.0 lib/helpers/time.rb
evertils-0.0.11 lib/helpers/time.rb