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.0.10 lib/helpers/time.rb
evertils-0.0.8 lib/helpers/time.rb
rbtils-0.0.2 lib/helpers/time.rb
evertils-0.0.7 lib/helpers/time.rb
evertils-0.0.6 lib/helpers/time.rb
evertils-0.0.5 lib/helpers/time.rb
evertils-0.0.4 lib/helpers/time.rb
evertils-0.0.3 lib/helpers/time.rb
evertils-0.0.2 lib/helpers/time.rb
rbtils-0.0.1 lib/helpers/time.rb
evertils-0.0.1 lib/helpers/time.rb