Sha256: ab23cbd7543fc788d480ecb39396642cf217d28d0727c9a7859c523783970177

Contents?: true

Size: 578 Bytes

Versions: 6

Compression:

Stored size: 578 Bytes

Contents

module ClockworkWeb
  module HomeHelper

    def friendly_period(period)
      if period % 1.day == 0
        pluralize(period / 1.day, "day")
      elsif period % 1.hour == 0
        pluralize(period / 1.hour, "hour")
      elsif period % 1.minute == 0
        "#{period / 1.minute} min"
      else
        "#{period} sec"
      end
    end

    def last_run(time)
      if time
        time_ago_in_words(time)
      end
    end

    def friendly_time_part(time_part)
      if time_part
        time_part.to_s.rjust(2, "0")
      else
        "**"
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clockwork_web-0.1.2 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.1.1 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.1.0 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.0.5 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.0.4 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.0.3 app/helpers/clockwork_web/home_helper.rb