Top Level Namespace

Defined Under Namespace

Modules: PuppetStrings

Instance Method Summary collapse

Instance Method Details

#box_infoString

Renders the box_info section.

Returns:

  • (String)

    Returns the rendered section.



9
10
11
12
# File 'lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb', line 9

def box_info
  @providers = PuppetStrings::Yard::CodeObjects::Providers.instance(object.name).children
  erb(:box_info)
end

#classesString

Renders the classes section.

Returns:

  • (String)

    Returns the rendered section.



128
129
130
131
132
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 128

def classes
  @title = 'Puppet Class Listing A-Z'
  @objects_by_letter = objects_by_letter(:puppet_class)
  erb(:objects)
end

#commandsString

Renders the commands section.

Returns:

  • (String)

    Returns the rendered section.



25
26
27
28
29
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 25

def commands
  @title = 'Commands'
  @collection = object.commands
  erb(:collection)
end

#confinesString

Renders the confines section.

Returns:

  • (String)

    Returns the rendered section.



9
10
11
12
13
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 9

def confines
  @title = 'Confines'
  @collection = object.confines
  erb(:collection)
end

#create_menu_listsArray<Hash>

Creates the dynamic menu lists.

Returns:

  • (Array<Hash>)

    Returns the dynamic menu list.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 58

def create_menu_lists
  menu_lists = [
    {
      type: 'puppet_class',
      title: 'Puppet Classes',
      search_title: 'Puppet Classes'
    },
    {
      type: 'puppet_defined_type',
      title: 'Defined Types',
      search_title: 'Defined Types',
    },
    {
      type: 'puppet_type',
      title: 'Resource Types',
      search_title: 'Resource Types'
    },
    {
      type: 'puppet_provider',
      title: 'Providers',
      search_title: 'Providers'
    },
    {
      type: 'puppet_function',
      title: 'Puppet Functions',
      search_title: 'Puppet Functions'
    },
    {
      type: 'class',
      title: 'Ruby Classes',
      search_title: 'Class List'
    },
    {
      type: 'method',
      title: 'Ruby Methods',
      search_title: 'Method List'
    },
  ]

  menu_lists.delete_if { |e| YARD::Registry.all(e[:type].intern).empty? }

  # We must always return at least one group, so always keep the files list
  menu_lists << {
    type: 'file',
    title: 'Files',
    search_title: 'File List'
  } if menu_lists.empty? || !YARD::Registry.all(:file).empty?

  menu_lists
end

#defaultsString

Renders the defaults section.

Returns:

  • (String)

    Returns the rendered section.



17
18
19
20
21
# File 'lib/puppet-strings/yard/templates/default/puppet_provider/html/setup.rb', line 17

def defaults
  @title = 'Default Provider For'
  @collection = object.defaults
  erb(:collection)
end

#defined_typesString

Renders the defined types section.

Returns:

  • (String)

    Returns the rendered section.



136
137
138
139
140
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 136

def defined_types
  @title = 'Defined Type Listing A-Z'
  @objects_by_letter = objects_by_letter(:puppet_defined_type)
  erb(:objects)
end

#functionsString

Renders the functions section.

Returns:

  • (String)

    Returns the rendered section.



160
161
162
163
164
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 160

def functions
  @title = 'Puppet Function Listing A-Z'
  @objects_by_letter = objects_by_letter(:puppet_function)
  erb(:objects)
end

#generate_class_listvoid

This method returns an undefined value.

Generate a searchable Ruby class list in the output.



59
60
61
62
63
64
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 59

def generate_class_list
  @items = options.objects if options.objects
  @list_title = 'Ruby Class List'
  @list_type = 'class'
  generate_list_contents
end

#generate_method_listvoid

This method returns an undefined value.

Generates the searchable Ruby method list.



48
49
50
51
52
53
54
55
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 48

def generate_method_list
  @items = prune_method_listing(Registry.all(:method), false)
  @items = @items.reject {|m| m.name.to_s =~ /=$/ && m.is_attribute? }
  @items = @items.sort_by {|m| m.name.to_s }
  @list_title = 'Ruby Method List'
  @list_type = 'method'
  generate_list_contents
end

#generate_puppet_class_listvoid

This method returns an undefined value.

Generates the searchable Puppet class list.



3
4
5
6
7
8
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 3

def generate_puppet_class_list
  @items = Registry.all(:puppet_class).sort_by { |c| c.name.to_s }
  @list_title = 'Puppet Class List'
  @list_type = 'puppet_class'
  generate_list_contents
end

#generate_puppet_defined_type_listvoid

This method returns an undefined value.

Generates the searchable Puppet defined type list.



12
13
14
15
16
17
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 12

def generate_puppet_defined_type_list
  @items = Registry.all(:puppet_defined_type).sort_by {|dt| dt.name.to_s }
  @list_title = 'Defined Type List'
  @list_type = 'puppet_defined_type'
  generate_list_contents
end

#generate_puppet_function_listvoid

This method returns an undefined value.

Generates the searchable Puppet function list.



39
40
41
42
43
44
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 39

def generate_puppet_function_list
  @items = Registry.all(:puppet_function).sort_by {|f| f.name.to_s }
  @list_title = 'Puppet Function List'
  @list_type = 'puppet_function'
  generate_list_contents
end

#generate_puppet_provider_listvoid

This method returns an undefined value.

Generates the searchable Puppet provider list.



30
31
32
33
34
35
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 30

def generate_puppet_provider_list
  @items = Registry.all(:puppet_provider).sort_by {|p| p.name.to_s }
  @list_title = 'Provider List'
  @list_type = 'puppet_provider'
  generate_list_contents
end

#generate_puppet_type_listvoid

This method returns an undefined value.

Generates the searchable Puppet resource type list.



21
22
23
24
25
26
# File 'lib/puppet-strings/yard/templates/default/fulldoc/html/setup.rb', line 21

def generate_puppet_type_list
  @items = Registry.all(:puppet_type).sort_by {|t| t.name.to_s }
  @list_title = 'Resource Type List'
  @list_type = 'puppet_type'
  generate_list_contents
end

#initvoid

This method returns an undefined value.

Initializes the template.



3
4
5
6
7
8
9
10
11
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 3

def init
  case object
  when '_index.html'
    @page_title = options.title
    sections :layout, [:index, [:listing, [:classes, :defined_types, :types, :providers, :functions, :files, :objects]]]
  else
    super
  end
end

#layoutString

Renders the layout section.

Returns:

  • (String)

    Returns the rendered section.



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
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 15

def layout
  @nav_url = url_for_list(!@file || options.index ? menu_lists.first[:type] : 'file')

  case object
  when nil, String
    @path = nil
  when @file
    @path = @file.path
  when !object.is_a?(YARD::CodeObjects::NamespaceObject)
    @path = object.parent.path
    @nav_url = url_for_list('class')
  when YARD::CodeObjects::ClassObject
    @path = object.path
    @nav_url = url_for_list('class')
  when PuppetStrings::Yard::CodeObjects::Class
    @nav_url = url_for_list('puppet_class')
    @page_title = "Puppet Class: #{object.name}"
    @path = object.path
  when PuppetStrings::Yard::CodeObjects::DefinedType
    @nav_url = url_for_list('puppet_defined_type')
    @page_title = "Defined Type: #{object.name}"
    @path = object.path
  when PuppetStrings::Yard::CodeObjects::Type
    @nav_url = url_for_list('puppet_type')
    @page_title = "Resource Type: #{object.name}"
    @path = object.path
  when PuppetStrings::Yard::CodeObjects::Provider
    @nav_url = url_for_list('puppet_provider')
    @page_title = "Provider: #{object.name}"
    @path = object.path
  when PuppetStrings::Yard::CodeObjects::Function
    @nav_url = url_for_list('puppet_function')
    @page_title = "Puppet Function: #{object.name} (#{object.function_type})"
    @path = object.path
  else
    @path = object.path
  end

  erb(:layout)
end

Gets the menu lists to use.

Returns:

  • (Array<Hash] Returns the menu lists to use.)

    Array<Hash] Returns the menu lists to use.



111
112
113
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 111

def menu_lists
  @@lists ||= create_menu_lists.freeze
end

#objectsString

Renders the objects section.

Returns:

  • (String)

    Returns the rendered section.



168
169
170
171
172
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 168

def objects
  @title = 'Ruby Namespace Listing A-Z'
  @objects_by_letter = objects_by_letter(:class, :module)
  erb(:objects)
end

#objects_by_letter(*types) ⇒ Hash

Builds a list of objects by letter.

Parameters:

  • types (Array)

    The types of objects to find.

Returns:

  • (Hash)

    Returns a hash of first letter of the object name to list of objects.



118
119
120
121
122
123
124
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 118

def objects_by_letter(*types)
  hash = {}
  objects = Registry.all(*types).sort_by {|o| o.name.to_s }
  objects = run_verifier(objects)
  objects.each {|o| (hash[o.name.to_s[0,1].upcase] ||= []) << o }
  hash
end

#overloadString

Renders the overload section.

Returns:

  • (String)

    Returns the rendered section.



13
14
15
# File 'lib/puppet-strings/yard/templates/default/tags/setup.rb', line 13

def overload
  erb(if object.type == :puppet_function then :puppet_overload else :overload end)
end

#paramArray<YARD::Tag>

Called to return parameter tags.

Returns:

  • (Array<YARD::Tag>)

    Returns the parameter tags if the object should have parameters.



3
4
5
6
7
8
9
# File 'lib/puppet-strings/yard/templates/default/tags/setup.rb', line 3

def param
  tag(:param) if
    object.type == :method ||
    object.type == :puppet_class ||
    object.type == :puppet_defined_type ||
    object.type == :puppet_function
end

#parametersString

Renders the parameters section.

Returns:

  • (String)

    Returns the rendered section.



27
28
29
30
31
32
# File 'lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb', line 27

def parameters
  @parameters = object.parameters || []
  @parameters.sort_by! { |p| p.name }
  @tag_title = 'Parameters'
  erb(:parameters)
end

#propertiesString

Renders the properties section.

Returns:

  • (String)

    Returns the rendered section.



16
17
18
19
20
21
22
23
# File 'lib/puppet-strings/yard/templates/default/puppet_type/html/setup.rb', line 16

def properties
  # Properties are the same thing as parameters (from the documentation standpoint),
  # so reuse the same template but with a different title and data source.
  @parameters = object.properties || []
  @parameters.sort_by! { |p| p.name }
  @tag_title = 'Properties'
  erb(:parameters)
end

#providersString

Renders the providers section.

Returns:

  • (String)

    Returns the rendered section.



152
153
154
155
156
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 152

def providers
  @title = 'Puppet Provider Listing A-Z'
  @objects_by_letter = objects_by_letter(:puppet_provider)
  erb(:objects)
end

#typesString

Renders the types section.

Returns:

  • (String)

    Returns the rendered section.



144
145
146
147
148
# File 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb', line 144

def types
  @title = 'Resource Type Listing A-Z'
  @objects_by_letter = objects_by_letter(:puppet_type)
  erb(:objects)
end