module Playa::Helpers
Public Instance Methods
duration(track)
click to toggle source
# File lib/playa/helpers/helpers.rb, line 3 def duration(track) human(track.duration.ceil) end
remaining(track, player)
click to toggle source
# File lib/playa/helpers/helpers.rb, line 7 def remaining(track, player) human((track.duration - player.counter).floor) end
Private Instance Methods
human(seconds)
click to toggle source
# File lib/playa/helpers/helpers.rb, line 13 def human(seconds) mm, ss = seconds.divmod(60) hh, mm = mm.divmod(60) mins = mm.to_s.rjust(2, '0') secs = ss.to_s.rjust(2, '0') [mins, secs].join(":") end