Class: Tilt::RDocTemplate

Inherits:
Template show all
Defined in:
lib/tilt/rdoc.rb

Overview

RDoc template. See: rdoc.rubyforge.org/

It’s suggested that your program ‘require ’rdoc/markup’‘ and `require ’rdoc/markup/to_html’‘ at load time when using this template engine in a threaded environment.

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#allows_script?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/tilt/rdoc.rb', line 36

def allows_script?
  false
end

#evaluate(scope, locals, &block) ⇒ Object



32
33
34
# File 'lib/tilt/rdoc.rb', line 32

def evaluate(scope, locals, &block)
  @output ||= @engine.to_s
end

#markupObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/tilt/rdoc.rb', line 16

def markup
  begin
    # RDoc 4.0
    require 'rdoc/options'
    RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
  rescue ArgumentError
    # RDoc < 4.0
    RDoc::Markup::ToHtml.new
  end
end

#prepareObject



27
28
29
30
# File 'lib/tilt/rdoc.rb', line 27

def prepare
  @engine = markup.convert(data)
  @output = nil
end