Class: Rundown::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/rundown/processor.rb

Constant Summary collapse

PUNCTUATION =
/[\s`!()\[\]{}\-;:'".,<>?]/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(words) ⇒ Processor

Returns a new instance of Processor.



7
8
9
10
# File 'lib/rundown/processor.rb', line 7

def initialize(words)
  @text = words
  @words = @text.to_s.split(/\s/)
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/rundown/processor.rb', line 3

def text
  @text
end

#wordsObject

Returns the value of attribute words.



3
4
5
# File 'lib/rundown/processor.rb', line 3

def words
  @words
end

Instance Method Details

#sentencesObject



12
13
14
# File 'lib/rundown/processor.rb', line 12

def sentences
  @sentences ||= text.gsub(/\s+/, ' ').strip.split(/\.|\?|!/)
end