Sha256: 75f2d201f085882ee1f5e70ac6125cf815f344ec25e9cb9ddf3c37039c3d9759

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 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, include_seconds: true)} ago"
      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

2 entries across 2 versions & 1 rubygems

Version Path
clockwork_web-0.3.1 app/helpers/clockwork_web/home_helper.rb
clockwork_web-0.3.0 app/helpers/clockwork_web/home_helper.rb