https://github.com/deepakmahakale/read-time
Read Time estimates the time required to read the article. Read Time also takes images in account while estimating the time.
https://github.com/deepakmahakale/read-time
article blog gem plugin ruby ruby-on-rails rubygem
Last synced: 5 months ago
JSON representation
Read Time estimates the time required to read the article. Read Time also takes images in account while estimating the time.
- Host: GitHub
- URL: https://github.com/deepakmahakale/read-time
- Owner: deepakmahakale
- Created: 2018-08-08T10:33:49.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-20T09:08:33.000Z (almost 8 years ago)
- Last Synced: 2025-11-10T00:56:18.691Z (7 months ago)
- Topics: article, blog, gem, plugin, ruby, ruby-on-rails, rubygem
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Read Time
[](https://travis-ci.org/deepakmahakale/read-time)
**Read Time** estimates the time required to read the article. Read Time also takes images in account while estimating the time.
```ruby
@article.body.readtime # => "1 minute read"
```
## Usage
### Install the gem using RubyGems
```bash
gem install read-time
```
or:
### Add it to your Gemfile
```ruby
gem 'read-time'
```
### Include it in your program
```ruby
require 'read-time'
```
### Call the method on the text
```ruby
@article.body.readtime #=> "2 minute read"
```
## Configuration
```ruby
# config/initializers/read-time.rb
ReadTime.configure do |config|
config.reading_speed = 300
config.format = :default # [:default, :long]
end
```
Default values can be overriden:
```ruby
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