Class: Crew::Docs

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

Instance Method Summary collapse

Constructor Details

#initialize(home) ⇒ Docs

Returns a new instance of Docs.



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

def initialize(home)
  @home = home
  @path = File.join(@home.home_path, "docs.html")
end

Instance Method Details

#generateObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/crew/docs.rb', line 8

def generate
  template = File.read(File.expand_path("../template/docs.html.erb", __FILE__))
  File.open(@path, 'w') do |file|
    home = @home
    def render_task(task)
      task_template = File.read(File.expand_path("../template/_task.html.erb", __FILE__))
      ERB.new(task_template).result(binding)
    end
    file << ERB.new(template).result(binding)
  end
  @path
end