21700: Install Bundler system-wide in Rails postinst
[arvados.git] / sdk / ruby-google-api-client / yard / templates / default / docstring / 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 def init
7   return if object.docstring.blank? && !object.has_tag?(:api)
8   sections :index, [:private, :deprecated, :abstract, :todo, :note, :returns_void, :text], T('tags')
9 end
10
11 def private
12   return unless object.has_tag?(:api) && object.tag(:api).text == 'private'
13   erb(:private)
14 end
15
16 def abstract
17   return unless object.has_tag?(:abstract)
18   erb(:abstract)
19 end
20
21 def deprecated
22   return unless object.has_tag?(:deprecated)
23   erb(:deprecated)
24 end
25
26 def todo
27   return unless object.has_tag?(:todo)
28   erb(:todo)
29 end
30
31 def note
32   return unless object.has_tag?(:note)
33   erb(:note)
34 end
35
36 def returns_void
37   return unless object.type == :method
38   return if object.name == :initialize && object.scope == :instance
39   return unless object.tags(:return).size == 1 && object.tag(:return).types == ['void']
40   erb(:returns_void)
41 end
42
43 def docstring_text
44   text = ""
45   unless object.tags(:overload).size == 1 && object.docstring.empty?
46     text = object.docstring
47   end
48
49   if text.strip.empty? && object.tags(:return).size == 1 && object.tag(:return).text
50     text = object.tag(:return).text.gsub(/\A([a-z])/) {|x| x.upcase }
51   end
52
53   text.strip
54 end