Class: TomDoc::Generators::HTML

Inherits:
TomDoc::Generator show all
Defined in:
lib/tomdoc/generators/html.rb

Instance Attribute Summary

Attributes inherited from TomDoc::Generator

#options, #scopes

Instance Method Summary collapse

Methods inherited from TomDoc::Generator

#constant?, #constant_names, generate, #generate, #initialize, #matches_pattern?, #process, #pygments, #valid?, #valid_tomdoc?, #write, #write_scope

Constructor Details

This class inherits a constructor from TomDoc::Generator

Instance Method Details

#highlight(text) ⇒ Object



4
5
6
# File 'lib/tomdoc/generators/html.rb', line 4

def highlight(text)
  pygments(text, '-l', 'ruby', '-f', 'html')
end

#write_class_methods(scope, prefix) ⇒ Object



14
15
16
17
18
# File 'lib/tomdoc/generators/html.rb', line 14

def write_class_methods(scope, prefix)
  out = '<ul>'
  out << super.to_s
  write out
end

#write_instance_methods(scope, prefix) ⇒ Object



20
21
22
23
24
25
# File 'lib/tomdoc/generators/html.rb', line 20

def write_instance_methods(scope, prefix)
  out = ''
  out << super.to_s
  out << '</ul>'
  write out
end

#write_method(method, prefix = '') ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tomdoc/generators/html.rb', line 27

def write_method(method, prefix = '')
  if method.args.any?
    args = '(' + method.args.join(', ') + ')'
  end
  out = '<li>'
  out << "<b>#{prefix}#{method.to_s}#{args}</b>"

  out << '<pre>'
  out << method.tomdoc.tomdoc
  out << '</pre>'

  out << '</li>'
end


11
12
# File 'lib/tomdoc/generators/html.rb', line 11

def write_scope_footer(scope, prefix)
end

#write_scope_header(scope, prefix) ⇒ Object



8
9
# File 'lib/tomdoc/generators/html.rb', line 8

def write_scope_header(scope, prefix)
end