Sha256: 7daff652647cf5ae6bb884f27cf7ca9196a16c5f7f134cd7b82fc90dede73f0e

Contents?: true

Size: 174 Bytes

Versions: 1

Compression:

Stored size: 174 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reading_time-0.1.0 lib/readingtime.rb