Class: PuppetDebugger::InputResponders::Classes

Inherits:
PuppetDebugger::InputResponderPlugin show all
Defined in:
lib/plugins/puppet-debugger/input_responders/classes.rb

Constant Summary collapse

COMMAND_WORDS =
%w(classes)
SUMMARY =
'List all the classes current in the catalog.'
COMMAND_GROUP =
:scope

Instance Attribute Summary

Attributes inherited from PuppetDebugger::InputResponderPlugin

#debugger

Instance Method Summary collapse

Methods inherited from PuppetDebugger::InputResponderPlugin

command_completion, command_group, command_words, details, execute, #modules_paths, #puppet_debugger_lib_dir, summary

Instance Method Details

#find_classes(classes, filter = []) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/plugins/puppet-debugger/input_responders/classes.rb', line 15

def find_classes(classes, filter = [])
  return classes if filter.nil? || filter.empty?
  filter_string = filter.join(' ').downcase
  classes.find_all do |klass|
    klass.downcase.include?(filter_string)
  end
end

#run(args = []) ⇒ Object



9
10
11
12
13
# File 'lib/plugins/puppet-debugger/input_responders/classes.rb', line 9

def run(args = [])
  filter = args
  classes = find_classes(debugger.catalog.classes, filter)
  classes.ai
end