Minor cleanup on tests
[arvados.git] / yard / templates / default / class / setup.rb
1 lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../../lib'))
2 $LOAD_PATH.unshift(lib_dir)
3 $LOAD_PATH.uniq!
4 require 'yard-google-code'
5
6 include T('default/module')
7
8 def init
9   super
10   sections.place(:subclasses).before(:children)
11   sections.place(:constructor_details, [T('method_details')]).before(:methodmissing)
12   # Weird bug w/ doubled sections
13   sections.uniq!
14 end
15
16 def constructor_details
17   ctors = object.meths(:inherited => true, :included => true)
18   return unless @ctor = ctors.find {|o| o.name == :initialize }
19   return if prune_method_listing([@ctor]).empty?
20   erb(:constructor_details)
21 end
22
23 def subclasses
24   return if object.path == "Object" # don't show subclasses for Object
25   unless globals.subclasses
26     globals.subclasses = {}
27     list = run_verifier Registry.all(:class)
28     list.each do |o|
29       (globals.subclasses[o.superclass.path] ||= []) << o if o.superclass
30     end
31   end
32
33   @subclasses = globals.subclasses[object.path]
34   return if @subclasses.nil? || @subclasses.empty?
35   @subclasses = @subclasses.sort_by {|o| o.path }.map do |child|
36     name = child.path
37     if object.namespace
38       name = object.relative_path(child)
39     end
40     [name, child]
41   end
42   erb(:subclasses)
43 end