Class: RTFDoc::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rtfdoc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ Generator

Returns a new instance of Generator.



461
462
463
464
465
# File 'lib/rtfdoc.rb', line 461

def initialize(config_path)
  @config       = YAML.load_file(config_path)
  @content_dir  = @config['content_dir']
  @parts        = {}
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



459
460
461
# File 'lib/rtfdoc.rb', line 459

def config
  @config
end

#rendererObject (readonly)

Returns the value of attribute renderer.



459
460
461
# File 'lib/rtfdoc.rb', line 459

def renderer
  @renderer
end

Instance Method Details

#runObject



467
468
469
470
471
472
473
474
# File 'lib/rtfdoc.rb', line 467

def run
  @tree = build_content_tree
  nodes = build_nodes(config['resources'])

  out = File.new("#{Dir.tmpdir}/rtfdoc_output.html", 'w')
  out.write(Template.new(nodes, config).output)
  out.close
end