Module: JekyllReadTime::ReadingTimeFilter

Defined in:
lib/jekyll-read-time/filter.rb

Instance Method Summary collapse

Instance Method Details

#read_time(input) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jekyll-read-time/filter.rb', line 14

def read_time( input )
  minutes = calculate_time(input)
  case minutes
  when 2 then minutes_s = 'two'
  when 3 then minutes_s = 'three'
  when 4 then minutes_s = 'four'
  when 5 then minutes_s = 'five'
  when 6 then minutes_s = 'six'
  when 7 then minutes_s = 'seven'
  when 8 then minutes_s = 'eight'
  when 9 then minutes_s = 'nine'
  else        minutes_s = minutes
  end
  minutes > 0 ? "#{minutes_s} minute read" : "less than one minute read"
end