Class: AbideDevUtils::Sce::Generate::Reference::Strings

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/sce/generate/reference.rb

Overview

Puppet Strings reference object

Constant Summary collapse

REGISTRY_TYPES =
%i[
  root
  module
  class
  puppet_class
  puppet_data_type
  puppet_data_type_alias
  puppet_defined_type
  puppet_type
  puppet_provider
  puppet_function
  puppet_task
  puppet_plan
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_patterns: nil, opts: {}) ⇒ Strings

Returns a new instance of Strings.



130
131
132
133
134
135
136
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 130

def initialize(search_patterns: nil, opts: {})
  @search_patterns = search_patterns || ::PuppetStrings::DEFAULT_SEARCH_PATTERNS
  @debug = opts[:debug]
  @quiet = opts[:quiet]
  ::PuppetStrings::Yard.setup!
  YARD::CLI::Yardoc.run(*yard_args(@search_patterns, debug: @debug, quiet: @quiet))
end

Instance Attribute Details

#search_patternsObject (readonly)

Returns the value of attribute search_patterns.



128
129
130
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 128

def search_patterns
  @search_patterns
end

Instance Method Details

#data_type_aliasesObject



165
166
167
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 165

def data_type_aliases
  @data_type_aliases ||= hashes_for_reg_type(:puppet_data_type_alias)
end

#data_typesObject



161
162
163
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 161

def data_types
  @data_types ||= hashes_for_reg_type(:puppet_data_types)
end

#debug?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 138

def debug?
  !!@debug
end

#defined_typesObject



169
170
171
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 169

def defined_types
  @defined_types ||= hashes_for_reg_type(:puppet_defined_type)
end

#find_resource(resource_name) ⇒ Object



150
151
152
153
154
155
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 150

def find_resource(resource_name)
  to_h.each do |_, resources|
    res = resources.find { |r| r[:name] == resource_name.to_sym }
    return res if res
  end
end

#providersObject



177
178
179
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 177

def providers
  @providers ||= hashes_for_reg_type(:puppet_provider)
end

#puppet_classesObject



157
158
159
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 157

def puppet_classes
  @puppet_classes ||= hashes_for_reg_type(:puppet_class)
end

#puppet_functionsObject



181
182
183
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 181

def puppet_functions
  @puppet_functions ||= hashes_for_reg_type(:puppet_function)
end

#puppet_plansObject



189
190
191
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 189

def puppet_plans
  @puppet_plans ||= hashes_for_reg_type(:puppet_plan)
end

#puppet_tasksObject



185
186
187
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 185

def puppet_tasks
  @puppet_tasks ||= hashes_for_reg_type(:puppet_task)
end

#quiet?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 142

def quiet?
  !!@quiet
end

#registryObject



146
147
148
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 146

def registry
  @registry ||= YARD::Registry.all(*REGISTRY_TYPES)
end

#resource_typesObject



173
174
175
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 173

def resource_types
  @resource_types ||= hashes_for_reg_type(:puppet_type)
end

#to_hObject



193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/abide_dev_utils/sce/generate/reference.rb', line 193

def to_h
  {
    puppet_classes: puppet_classes,
    data_types: data_types,
    data_type_aliases: data_type_aliases,
    defined_types: defined_types,
    resource_types: resource_types,
    providers: providers,
    puppet_functions: puppet_functions,
    puppet_tasks: puppet_tasks,
    puppet_plans: puppet_plans
  }
end