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.



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 43

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

  # The Parameter-header may have been set,
  # avoid unnecessary activity. Currently unused !
  unless(@@config.skip_pp )
    headers.update(article_text)
    newsgroups = headers.newsgroups
    body.set_signature(newsgroups.signature)
    body.set_intro(newsgroups.intro)
  else # unused
    @log.info('Post-Processig disabled. Bye!')
  end
  # 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