Class: PostProcessor

Inherits:
Object
  • Object
show all
Extended by:
Logging
Defined in:
lib/flnews_post_proc.rb

Overview

The main application class.

Does it.

Constant Summary collapse

@@config =

class-level configuration object

Configuration.instance
@@log =

class-level logger as configured

init_logger(@@config.log_target, @@config.log_level)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

init_logger, log_level=, log_target=

Constructor Details

#initialize(article_text) ⇒ PostProcessor

Returns a new instance of PostProcessor.



35
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
# File 'lib/flnews_post_proc.rb', line 35

def initialize(article_text)
  # for simplicity.
  @log = @@log
  # separate the headers and the body.
  headers = Headers.new(article_text)
  @log.debug('headers is ' << headers.inspect)
  body = Body.new(article_text)

  @log.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
  @log.debug('article is now : ' << @article.inspect)
end

Instance Attribute Details

#articleObject (readonly)

Returns the value of attribute article.



66
67
68
# File 'lib/flnews_post_proc.rb', line 66

def article
  @article
end