Class: Cosmos::HandbookCreatorConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/cosmos/tools/handbook_creator/handbook_creator_config.rb

Overview

Reads an ascii file that defines the configuration settings used to configure the Handbook Creator

Defined Under Namespace

Classes: Page, Section

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ HandbookCreatorConfig

Parses the configuration file.

Parameters:

  • filename (String)

    The name of the configuration file to parse



257
258
259
260
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 257

def initialize(filename)
  @pages = []
  process_file(filename)
end

Instance Attribute Details

#pagesObject (readonly)

Returns the value of attribute pages.



22
23
24
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 22

def pages
  @pages
end

Instance Method Details

#create_html(hide_ignored) ⇒ Object



262
263
264
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 262

def create_html(hide_ignored)
  @pages.each {|page| page.create_html(hide_ignored)}
end

#create_pdf(hide_ignored, progress_dialog = nil) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 266

def create_pdf(hide_ignored, progress_dialog = nil)
  begin
    @pages.each_with_index do |page, index|
      progress_dialog.set_overall_progress(index.to_f / @pages.length.to_f) if progress_dialog
      page.create_pdf(hide_ignored, progress_dialog)
    end
    progress_dialog.set_overall_progress(1.0) if progress_dialog
  rescue Exception => err
    if err.message == "Call to wkhtmltopdf failed"
      return false
    else
      raise err
    end
  end
  true
end