webtranslateit / word_count

A word counter for String and Hash in Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

word_count

This gem adds one word_count method to String and Hash. It calls the Unix wc system command to count the amount of words in a String or a Hash. Other ways to count words (using regexes) are unreliable for counting words in foreign languages.

Installation

# add this to your Gemfile
gem "word_count"

# and  run
bundle update

Usage

str = "the brown fox jumped over the lazy dog"
str.word_count # => 8

Copyright (c) 2013 Atelier Convivialité.

About

A word counter for String and Hash in Ruby

License:MIT License


Languages

Language:Ruby 100.0%