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



235
236
237
238
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 235

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_htmlObject



240
241
242
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 240

def create_html
  @pages.each {|page| page.create_html}
end

#create_pdf(progress_dialog = nil) ⇒ Object



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 244

def create_pdf(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(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