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.



218
219
220
221
222
223
224
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 218

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.



213
214
215
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 213

def filename
  @filename
end

#outputObject (readonly)

Returns the value of attribute output.



216
217
218
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 216

def output
  @output
end

#titleObject (readonly)

Returns the value of attribute title.



215
216
217
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 215

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



214
215
216
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 214

def type
  @type
end

Instance Method Details

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



226
227
228
# File 'lib/cosmos/tools/handbook_creator/handbook_creator_config.rb', line 226

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