Class: PuppetDebugServer::DebugSession::SavedPuppetSessionState

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-debugserver/debug_session/puppet_session_state.rb

Overview

The state of Puppet when a debug session was paused, typically during a breakpoint or exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSavedPuppetSessionState

Returns a new instance of SavedPuppetSessionState.



90
91
92
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 90

def initialize
  @variable_cache = {}
end

Instance Attribute Details

#exceptionObject (readonly)

The exception thrown when the session was paused.

Returns:

  • (Object)


68
69
70
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 68

def exception
  @exception
end

#pops_depth_levelInteger (readonly)

The AST depth of the Pops Object that caused the session to pause.

Returns:

  • (Integer)


84
85
86
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 84

def pops_depth_level
  @pops_depth_level
end

#pops_targetObject (readonly)

The Pops Object that caused the session to pause.

Returns:

  • (Object)


76
77
78
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 76

def pops_target
  @pops_target
end

#puppet_stacktraceArray<Object> (readonly)

The puppet stacktrace, not ruby stacktrace, when the session was paused.

Returns:

  • (Array<Object>)


72
73
74
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 72

def puppet_stacktrace
  @puppet_stacktrace
end

#scopePuppet::Parser::Scope (readonly)

The Pops Scope containing the Pops Object that caused the session to pause.

Returns:

  • (Puppet::Parser::Scope)


80
81
82
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 80

def scope
  @scope
end

#variable_cacheHash<Integer, Object> (readonly)

A cache of variable references used to speed up Debug Server VariableReferences queries.

Returns:

  • (Hash<Integer, Object>)


88
89
90
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 88

def variable_cache
  @variable_cache
end

Instance Method Details

#clear!Object

Clears the saved state. Typically used a debug session is un-paused.



111
112
113
114
115
116
117
118
119
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 111

def clear!
  @exception = nil
  @puppet_stacktrace = nil
  @pops_target = nil
  @scope = nil
  @pops_depth_level = nil
  @variable_cache = {}
  self
end

#update!(options = {}) ⇒ Object

Updates the saved session state

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :exception (Object)
  • :puppet_stacktrace (Object)
  • :pops_target (Object)
  • :scope (Object)
  • :pops_depth_level (Object)

See Also:



101
102
103
104
105
106
107
108
# File 'lib/puppet-debugserver/debug_session/puppet_session_state.rb', line 101

def update!(options = {})
  @exception         = options[:session_exception] unless options[:session_exception].nil?
  @puppet_stacktrace = options[:puppet_stacktrace] unless options[:puppet_stacktrace].nil?
  @pops_target       = options[:pops_target] unless options[:pops_target].nil?
  @scope             = options[:scope] unless options[:scope].nil?
  @pops_depth_level  = options[:pops_depth_level] unless options[:pops_depth_level].nil?
  self
end