Sha256: 79f2583d8aced2c651b85da5a12a1d48d10e465439e9adf079e364c6aff625ae
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
module RandomText class RandomText def initialize(text) @words = RandomStrings.new(text.scan(/\w{3,}/).collect{ |w| w.chars.downcase.to_s }.reject{ |w| w =~ /^[0-9]/ }.uniq.map(&:chars)) @sentences = RandomStrings.new(text.split(/[\r\n]+/).uniq) end def word @words.get end def words(n) @words.get(n) end def uniq_words(n) @words.uniq(n) end alias_method :unique_words, :uniq_words def sentence @sentences.get end def sentences(n) @sentences.get(n) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
random_text-0.0.3 | lib/random_text/random_text.rb |