Class: Byebug::DAP::Handles Private

Inherits:
Object
  • Object
show all
Defined in:
lib/byebug/dap/helpers/handles.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Tracks opaque handles used by DAP.

Instance Method Summary collapse

Constructor Details

#initializeHandles

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Handles.



6
7
8
9
# File 'lib/byebug/dap/helpers/handles.rb', line 6

def initialize
  @mu = Mutex.new
  @entries = []
end

Instance Method Details

#<<(entry) ⇒ std:Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add a new entry.

Returns:

  • (std:Integer)

    the handle



25
26
27
28
29
30
# File 'lib/byebug/dap/helpers/handles.rb', line 25

def <<(entry)
  sync do
    @entries << entry
    @entries.size
  end
end

#[](id) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieve the entry with the specified handle.

Parameters:

  • id (std:Integer)

    the handle

Returns:

  • the entry



19
20
21
# File 'lib/byebug/dap/helpers/handles.rb', line 19

def [](id)
  sync { @entries[id-1] }
end

#clear!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delete all handles.



12
13
14
# File 'lib/byebug/dap/helpers/handles.rb', line 12

def clear!
  sync { @entries = []; nil }
end