Method: Webgen::Website#initialize

Defined in:
lib/webgen/website.rb

#initialize(dir, logger = nil, &block) ⇒ Website

Create a new webgen Website object for the website in the directory dir.

If no logger is specified, a dummy logger that logs to a StringIO is created.

You can provide a block for modifying the Website object in any way during the initialization:

  • If the block only takes one parameter, it is called with the Website object after the initialization is done but before the cache is restored.

  • If it takes two parameters, the first one is the Website object and the second one is a boolean specifying whether the block is currently called any initialization (value is true) or after it (value is +false).



96
97
98
99
100
101
# File 'lib/webgen/website.rb', line 96

def initialize(dir, logger = nil, &block)
  @directory = dir
  @logger = logger || Webgen::Logger.new(StringIO.new)
  @init_block = block
  init
end