Class: AbideDevUtils::CEM::Generate::Reference::Strings

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/cem/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.



124
125
126
127
128
129
130
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 124

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.



122
123
124
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 122

def search_patterns
  @search_patterns
end

Instance Method Details

#data_type_aliasesObject



159
160
161
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 159

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

#data_typesObject



155
156
157
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 155

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

#debug?Boolean

Returns:

  • (Boolean)


132
133
134
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 132

def debug?
  !!@debug
end

#defined_typesObject



163
164
165
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 163

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

#find_resource(resource_name) ⇒ Object



144
145
146
147
148
149
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 144

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



171
172
173
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 171

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

#puppet_classesObject



151
152
153
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 151

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

#puppet_functionsObject



175
176
177
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 175

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

#puppet_plansObject



183
184
185
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 183

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

#puppet_tasksObject



179
180
181
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 179

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

#quiet?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 136

def quiet?
  !!@quiet
end

#registryObject



140
141
142
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 140

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

#resource_typesObject



167
168
169
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 167

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

#to_hObject



187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/abide_dev_utils/cem/generate/reference.rb', line 187

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