Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
Tree: d7a2e989a0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README.md
Rakefile
readingtime.gemspec

README.md

Estimate Reading Time

Build Status

I use iA Writer and find the estimated reading time feature pretty handy. I thought it would be cool to add at the top of my blog articles on the web as others do.

How to Use

readingtime extends the Ruby String class, so you can call reading_time on any String object.

Install

gem install readingtime

In irb

$ irb
> require 'readingtime'
    => true
> @words = "Lorem ipsum dolor sit amet"
> @words.reading_time
    => "0:01"

In Your App

<article>

    <header>
        <h1><%= @article.title %></h1>
        <span class="readingtime">Estimated reading time – <%= @article.body.reading_time %></span>
    </header>

    <%= @article.body %>

</article>

And voila!

Screenshot of readingtime in use

Thanks

Credit goes to Brian Cray for explaining how to do it in PHP.

Something went wrong with that request. Please try again.