Module: I18n::WordCount

Defined in:
lib/rails-i18n-word-count.rb

Class Method Summary collapse

Class Method Details

.word_count(prefix, min_length = 2) ⇒ Object



3
4
5
# File 'lib/rails-i18n-word-count.rb', line 3

def self.word_count(prefix, min_length = 2)
  count_hash(I18n.t(prefix)).flatten.collect{ |x| x.split(/\s/) }.flatten.select{ |x| x.length >= min_length }.count
end