Module: ClockworkWeb::HomeHelper

Defined in:
app/helpers/clockwork_web/home_helper.rb

Instance Method Summary collapse

Instance Method Details

#friendly_period(period) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/clockwork_web/home_helper.rb', line 3

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

#friendly_time_part(time_part) ⇒ Object



21
22
23
24
25
26
27
# File 'app/helpers/clockwork_web/home_helper.rb', line 21

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

#last_run(time) ⇒ Object



15
16
17
18
19
# File 'app/helpers/clockwork_web/home_helper.rb', line 15

def last_run(time)
  if time
    "#{time_ago_in_words(time, include_seconds: true)} ago"
  end
end