Class: Documented::Renderer

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

Instance Method Summary collapse

Constructor Details

#initialize(package_path, output_path) ⇒ Renderer

Returns a new instance of Renderer.



3
4
5
6
# File 'lib/renderer.rb', line 3

def initialize(package_path, output_path)
  @package_path = package_path
  @output_path = output_path
end

Instance Method Details

#renderObject

Place files in output path.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/renderer.rb', line 9

def render()
  filenames = [
    "README.md",
  ]

  filenames.each do |filename|
    file = File.read(File.join(@package_path, "output", filename))
    File.open(File.join(@output_path, filename), 'w+') do |f|
      f.write file
    end
  end

  file = File.read(File.join(@package_path, "output", "gitignore.txt"))
  File.open(File.join(@output_path, ".gitignore"), 'w+') do |f|
    f.write file
  end
end