Class: PuppetStrings::Markdown::ResourceType

Inherits:
Base
  • Object
show all
Defined in:
lib/puppet-strings/markdown/resource_type.rb

Instance Method Summary collapse

Methods inherited from Base

#defaults, #enums, #enums_for_param, #examples, #link, #name, #options, #options_for_param, #params, #private?, #raises, #return_type, #see, #since, #text, #toc_info, #value_string, #word_wrap

Constructor Details

#initialize(registry) ⇒ ResourceType

Returns a new instance of ResourceType.



7
8
9
10
# File 'lib/puppet-strings/markdown/resource_type.rb', line 7

def initialize(registry)
  @template = 'resource_type.erb'
  super(registry, 'type')
end

Instance Method Details

#checksObject



22
23
24
25
26
# File 'lib/puppet-strings/markdown/resource_type.rb', line 22

def checks
  return nil unless @registry[:checks]

  @registry[:checks].sort_by { |p| p[:name] }
end

#parametersObject



35
36
37
38
39
# File 'lib/puppet-strings/markdown/resource_type.rb', line 35

def parameters
  return nil unless @registry[:parameters]

  @registry[:parameters].sort_by { |p| p[:name] }
end

#propertiesObject



16
17
18
19
20
# File 'lib/puppet-strings/markdown/resource_type.rb', line 16

def properties
  return nil unless @registry[:properties]

  @registry[:properties].sort_by { |p| p[:name] }
end

#properties_and_checksObject

“checks” (such as “onlyif” or “creates”) are another type of property



29
30
31
32
33
# File 'lib/puppet-strings/markdown/resource_type.rb', line 29

def properties_and_checks
  return nil if properties.nil? && checks.nil?

  ((properties || []) + (checks || [])).sort_by { |p| p[:name] }
end

#regex_in_data_type?(data_type) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/puppet-strings/markdown/resource_type.rb', line 41

def regex_in_data_type?(data_type)
  m = data_type.match(/\w+\[\/.*\/\]/)
  m unless m.nil? || m.length.zero?
end

#renderObject



12
13
14
# File 'lib/puppet-strings/markdown/resource_type.rb', line 12

def render
  super(@template)
end