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
|
# File 'lib/amp/support/docs.rb', line 14
def docs_for(method)
klass = YARD::Registry.all(:class).detect do |k|
k.name == name.split("::").last.to_sym
end
meth = klass.meths.detect {|m| m.name == method }
puts "=== Documentation for #{self}##{method}"
puts meth.docstring
puts "---"
puts meth.signature
puts
tag_callbacks.to_a.sort.each do |(tag, block)|
if meth.has_tag? tag
puts
tags = meth.tags.select {|t| t.tag_name == tag.to_s }
block.call meth, tags
puts
end
end
puts "It can be found at #{meth.file}:#{meth.line}"
puts "==="
end
|