Class: AbideDevUtils::PuppetStrings

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/puppet_strings.rb

Overview

Puppet Strings reference object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of PuppetStrings.



11
12
13
14
15
16
17
18
# File 'lib/abide_dev_utils/puppet_strings.rb', line 11

def initialize(search_patterns: nil, opts: {})
  check_yardoc_dir
  @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.



9
10
11
# File 'lib/abide_dev_utils/puppet_strings.rb', line 9

def search_patterns
  @search_patterns
end

Instance Method Details

#data_type_aliasesObject



43
44
45
# File 'lib/abide_dev_utils/puppet_strings.rb', line 43

def data_type_aliases
  @data_type_aliases ||= all_to_h YARD::Registry.all(:puppet_data_type_alias)
end

#data_typesObject



39
40
41
# File 'lib/abide_dev_utils/puppet_strings.rb', line 39

def data_types
  @data_types ||= all_to_h YARD::Registry.all(:puppet_data_types)
end

#debug?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/abide_dev_utils/puppet_strings.rb', line 20

def debug?
  !!@debug
end

#defined_typesObject



47
48
49
# File 'lib/abide_dev_utils/puppet_strings.rb', line 47

def defined_types
  @defined_types ||= all_to_h YARD::Registry.all(:puppet_defined_type)
end

#find_resource(resource_name) ⇒ Object



28
29
30
31
32
33
# File 'lib/abide_dev_utils/puppet_strings.rb', line 28

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



55
56
57
# File 'lib/abide_dev_utils/puppet_strings.rb', line 55

def providers
  @providers ||= all_to_h YARD::Registry.all(:puppet_provider)
end

#puppet_classesObject



35
36
37
# File 'lib/abide_dev_utils/puppet_strings.rb', line 35

def puppet_classes
  @puppet_classes ||= all_to_h YARD::Registry.all(:puppet_class)
end

#puppet_functionsObject



59
60
61
# File 'lib/abide_dev_utils/puppet_strings.rb', line 59

def puppet_functions
  @puppet_functions ||= all_to_h YARD::Registry.all(:puppet_function)
end

#puppet_plansObject



67
68
69
# File 'lib/abide_dev_utils/puppet_strings.rb', line 67

def puppet_plans
  @puppet_plans ||= all_to_h YARD::Registry.all(:puppet_plan)
end

#puppet_tasksObject



63
64
65
# File 'lib/abide_dev_utils/puppet_strings.rb', line 63

def puppet_tasks
  @puppet_tasks ||= all_to_h YARD::Registry.all(:puppet_task)
end

#quiet?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/abide_dev_utils/puppet_strings.rb', line 24

def quiet?
  !!@quiet
end

#resource_typesObject



51
52
53
# File 'lib/abide_dev_utils/puppet_strings.rb', line 51

def resource_types
  @resource_types ||= all_to_h YARD::Registry.all(:puppet_type)
end

#to_hObject



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/abide_dev_utils/puppet_strings.rb', line 71

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