class Rundown::Processor

Constants

PUNCTUATION

Attributes

text[RW]
words[RW]

Public Class Methods

new(words) click to toggle source
# File lib/rundown/processor.rb, line 7
def initialize(words)
  @text = words
  @words = @text.to_s.split(/\s/)
end

Public Instance Methods

sentences() click to toggle source
# File lib/rundown/processor.rb, line 12
def sentences
  @sentences ||= text.gsub(/\s+/, ' ').strip.split(/\.|\?|!/)
end

Private Instance Methods

remove_punctuation(word) click to toggle source
# File lib/rundown/processor.rb, line 22
def remove_punctuation(word)
  word.gsub(/#{PUNCTUATION}/, '')
end
strip_punctuation(word) click to toggle source
# File lib/rundown/processor.rb, line 18
def strip_punctuation(word)
  word.gsub(/^#{PUNCTUATION}/, '').gsub(/#{PUNCTUATION}$/, '')
end