Class: PostProcessor
- Inherits:
-
Object
- Object
- PostProcessor
- Includes:
- BasicLogging
- Defined in:
- lib/flnews_post_proc.rb
Overview
The main application class.
Does it.
Constant Summary collapse
- @@config =
class-level configuration object
Configuration.instance
Constants included from BasicLogging
BasicLogging::DEBUG, BasicLogging::ERROR, BasicLogging::FATAL, BasicLogging::INFO, BasicLogging::Levels, BasicLogging::UNKNOWN, BasicLogging::WARN
Instance Attribute Summary collapse
-
#article ⇒ Object
readonly
Returns the value of attribute article.
Attributes included from BasicLogging
Instance Method Summary collapse
-
#initialize(article_text) ⇒ PostProcessor
constructor
A new instance of PostProcessor.
Methods included from BasicLogging
is_muted?, #log, mute, #set_level, #set_target
Constructor Details
#initialize(article_text) ⇒ PostProcessor
Returns a new instance of PostProcessor.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/flnews_post_proc.rb', line 36 def initialize(article_text) # for simplicity. # separate the headers and the body. debug ' initializing headers' headers = Headers.new(article_text) debug('headers is ' << headers.inspect) body = Body.new(article_text) debug('calling headers.update') headers.update() newsgroups = headers.newsgroups # Order matters. These actions work on a # preliminary version of the article, each # one on the result of the previous ! body.set_intro(newsgroups.intro) # if need be, extract references and footnotes. body.handle_references body.set_signature(newsgroups.signature) # verify and eventually correct URLs body.handle_urls # get the headers and the body as a string. # Assemble. @article = headers.join << $LN << body.join diff = Diffy::Diff.new(article_text, @article, :context => 2).to_s info("\n" << "–" * 20 << "\nDiffs\n" << "–" * 20 << "\n" << diff) end |
Instance Attribute Details
#article ⇒ Object (readonly)
Returns the value of attribute article.
69 70 71 |
# File 'lib/flnews_post_proc.rb', line 69 def article @article end |