Class: RDoc::Generator::TexinfoTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generator/texinfo.rb

Overview

Basically just a wrapper around ERB. Should probably use RDoc::TemplatePage instead

Constant Summary collapse

BASE_DIR =

have to calculate this when the file’s loaded.

::File.expand_path(::File.dirname(__FILE__))

Instance Method Summary collapse

Constructor Details

#initialize(values, file = 'texinfo.erb') ⇒ TexinfoTemplate

Returns a new instance of TexinfoTemplate.



54
55
56
# File 'lib/rdoc/generator/texinfo.rb', line 54

def initialize(values, file = 'texinfo.erb')
  @v, @file = [values, file]
end

Instance Method Details

#href(location, text) ⇒ Object



67
68
69
# File 'lib/rdoc/generator/texinfo.rb', line 67

def href(location, text)
  text # TODO: how does texinfo do hyperlinks?
end

#method_prefix(section) ⇒ Object

TODO: this is probably implemented elsewhere?



76
77
78
79
80
81
# File 'lib/rdoc/generator/texinfo.rb', line 76

def method_prefix(section)
  { 'Class' => '.',
    'Module' => '::',
    'Instance' => '#',
  }[section['category']]
end

#renderObject

Go!



63
64
65
# File 'lib/rdoc/generator/texinfo.rb', line 63

def render
  ERB.new(template).result binding
end

#target(name, text) ⇒ Object



71
72
73
# File 'lib/rdoc/generator/texinfo.rb', line 71

def target(name, text)
  text # TODO: how do hyperlink targets work?
end

#templateObject



58
59
60
# File 'lib/rdoc/generator/texinfo.rb', line 58

def template
  ::File.read(::File.join(BASE_DIR, 'texinfo', @file))
end