Class: TrackOpenInstances::OpenInstance Private

Inherits:
Object
  • Object
show all
Defined in:
lib/track_open_instances.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.

Represents an open instance of a class that includes TrackOpenInstances

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance, creation_stack)

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.

Initializes a new OpenInstance

Parameters:

  • instance (Object)

    The tracked instance

  • creation_stack (Array<Thread::Backtrace::Location>)

    The call stack at the time of instance creation



75
76
77
78
# File 'lib/track_open_instances.rb', line 75

def initialize(instance, creation_stack)
  @instance = instance
  @creation_stack = creation_stack
end

Instance Attribute Details

#creation_stackArray<String> (readonly)

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.

The call stack at the time of instance creation

This is useful for debugging and identifying where the instance was created.

Returns:

  • (Array<String>)

    the current value of creation_stack



62
63
64
# File 'lib/track_open_instances.rb', line 62

def creation_stack
  @creation_stack
end

#instanceObject (readonly)

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.

The tracked instance

Returns:

  • (Object)

    the current value of instance



62
63
64
# File 'lib/track_open_instances.rb', line 62

def instance
  @instance
end