Class: Cosmos::HandbookCreatorConfig::Section

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

Overview

class Page

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output, filename, title, type = :NONE) ⇒ Section

Returns a new instance of Section.



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

def initialize(output, filename, title, type = :NONE)
  raise "Unknown output: #{output.to_s.upcase}" unless ['ALL', 'HTML', 'PDF'].include?(output.to_s.upcase)
  @output = output.to_s.upcase.intern
  @filename = File.join(USERPATH, 'config', 'tools', 'handbook_creator', 'templates', filename)
  @title = title
  @type = type
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

#outputObject (readonly)

Returns the value of attribute output.



238
239
240
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 238

def output
  @output
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#create(file, title, packets = [], ignored = {}) ⇒ Object



248
249
250
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 248

def create(file, title, packets = [], ignored = {})
  file.puts ERB.new(File.read(@filename)).result(binding)
end