Read Time
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-timeor:
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]
endDefault 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