Class: Rundown::Processor
- Inherits:
-
Object
- Object
- Rundown::Processor
- Defined in:
- lib/rundown/processor.rb
Direct Known Subclasses
Rundown::Processors::Dates, Rundown::Processors::Email, Rundown::Processors::Frequency, Rundown::Processors::Hashtags, Rundown::Processors::Links, Rundown::Processors::Phone, Rundown::Processors::ReadingGrade, Rundown::Processors::ReadingTime, Rundown::Processors::Sentiment, Rundown::Processors::Twitter
Constant Summary collapse
- PUNCTUATION =
/[\s`!()\[\]{}\-;:'".,<>?]/
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
-
#words ⇒ Object
Returns the value of attribute words.
Instance Method Summary collapse
-
#initialize(words) ⇒ Processor
constructor
A new instance of Processor.
- #sentences ⇒ Object
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
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/rundown/processor.rb', line 3 def text @text end |
#words ⇒ Object
Returns the value of attribute words.
3 4 5 |
# File 'lib/rundown/processor.rb', line 3 def words @words end |
Instance Method Details
#sentences ⇒ Object
12 13 14 |
# File 'lib/rundown/processor.rb', line 12 def sentences @sentences ||= text.gsub(/\s+/, ' ').strip.split(/\.|\?|!/) end |