class Object

Public Instance Methods

time_to_read(string) click to toggle source
# File lib/readingtime.rb, line 1
def time_to_read(string)
  words = string.scan(/\w+/).size
  time = (words.to_f/180).ceil
  if time == 1
    "less than a minute"
  else
    "about #{time} minutes"
  end
end