Class: PuppetDebugger::InputResponders::Vars

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

Constant Summary collapse

COMMAND_WORDS =
%w(vars ls)
SUMMARY =
'List all the variables in the current scopes.'
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, summary

Instance Method Details

#run(args = []) ⇒ Object



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

def run(args = [])
  # remove duplicate variables that are also in the facts hash
  variables = debugger.scope.to_hash.delete_if { |key, _value| debugger.node.facts.values.key?(key) }
  variables['facts'] = 'removed by the puppet-debugger' if variables.key?('facts')
  output = 'Facts were removed for easier viewing'.ai + "\n"
  output += variables.ai(sort_keys: true, indent: -1)
end