6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/flex/class_proxy/templates/doc.rb', line 6
def doc(*names)
names = templates.keys if names.empty?
doc = "\n"
names.each do |name|
next unless templates.include?(name)
block = ''
temp = templates[name]
meth_call = [context, name].join('.')
block << <<-meth_call
########## #{meth_call} ##########
#{'-' * temp.class.to_s.length}
#{temp.class}
#{temp.to_source}
meth_call
temp.partials.each do |par_name|
par = partials[par_name]
block << <<-partial
#{'-' * par.class.to_s.length}
#{par.class}
#{par.to_source}
partial
end
block << "\nUsage:\n"
block << build_usage(meth_call, temp)
block << "\n "
doc << block.split("\n").map{|l| '# ' + l}.join("\n")
doc << <<-meth.gsub(/^ {14}/m,'')
def #{meth_call}(*vars)
## this is a stub, used for reference
super
end
meth
end
puts doc
end
|