Class: PuppetStrings::Markdown::ResourceType
- Inherits:
-
Base
- Object
- Base
- PuppetStrings::Markdown::ResourceType
show all
- Defined in:
- lib/puppet-strings/markdown/resource_type.rb
Overview
Generates Markdown for a Puppet Resource Type.
Instance Method Summary
collapse
Methods inherited from Base
#defaults, #enums, #enums_for_param, #examples, group_name, items, #link, #name, #options, #options_for_param, #params, #private?, #raises, #return_type, #see, #since, #text, #toc_info, #word_wrap, yard_types
Methods included from Helpers
#code_maybe_block
Constructor Details
Returns a new instance of ResourceType.
11
12
13
14
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 11
def initialize(registry)
@template = 'resource_type.erb'
super(registry, 'type')
end
|
Instance Method Details
#checks ⇒ Object
26
27
28
29
30
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 26
def checks
return nil unless @registry[:checks]
@registry[:checks].sort_by { |p| p[:name] }
end
|
#parameters ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 42
def parameters
return nil unless @registry[:parameters]
@registry[:parameters].sort_by { |p| p[:name] }.map do |param|
param[:link] = clean_link("$#{name}::#{param[:name]}")
param
end
end
|
#properties ⇒ Object
20
21
22
23
24
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 20
def properties
return nil unless @registry[:properties]
@registry[:properties].sort_by { |p| p[:name] }
end
|
#properties_and_checks ⇒ Object
“checks” (such as “onlyif” or “creates”) are another type of property
33
34
35
36
37
38
39
40
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 33
def properties_and_checks
return nil if properties.nil? && checks.nil?
((properties || []) + (checks || [])).sort_by { |p| p[:name] }.map do |prop|
prop[:link] = clean_link("$#{name}::#{prop[:name]}")
prop
end
end
|
#regex_in_data_type?(data_type) ⇒ Boolean
51
52
53
54
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 51
def regex_in_data_type?(data_type)
m = data_type.match(%r{\w+\[/.*/\]})
m unless m.nil? || m.to_a.empty?
end
|
#render ⇒ Object
16
17
18
|
# File 'lib/puppet-strings/markdown/resource_type.rb', line 16
def render
super(@template)
end
|