class Granify::Helper::Time

Public Class Methods

formatted(time = nil) click to toggle source
# File lib/helpers/time.rb, line 19
def self.formatted(time = nil)
  if time.nil?
    time = ::Time.now
  end
  
  time.strftime("%e/%-m/%Y @ %I:%M:%S%P")
end
human_readable(start, finish) click to toggle source
# File lib/helpers/time.rb, line 4
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