Project

read-time

0.0
No commit activity in last 3 years
No release in over 3 years
ReadTime estimates the time required to read the article.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

Read Time

Build Status

Read Time estimates the time required to read the article. Read Time also takes images in account while estimating the time.

@article.body.readtime  # => "1 minute read"

Usage

Install the gem using RubyGems

gem install read-time

or:

Add it to your Gemfile

gem 'read-time'

Include it in your program

require 'read-time'

Call the method on the text

@article.body.readtime #=> "2 minute read"

Configuration

# config/initializers/read-time.rb
ReadTime.configure do |config|
  config.reading_speed  = 300
  config.format         = :default # [:default, :long]
end

Default values can be overriden:

text = 'word ' * 300
text.readtime #=> "2 minute read"
text.readtime(reading_speed: 300) #=> "1 minute read"
text.readtime(reading_speed: 200, format: :long) #=> "1 minute 30 second read"

TODO

  • I18n support
  • Calculation based on images