Class: ThreadSafety::Offense
- Inherits:
-
Object
- Object
- ThreadSafety::Offense
- Defined in:
- lib/thread_safety/offense.rb
Constant Summary collapse
- CALLER_SKIP =
Ruby 3.4 includes an extra
Class#newframe in the call stack compared to Ruby 4.0 RUBY_VERSION >= "4.0" ? 2 : 3
Instance Attribute Summary collapse
-
#access_fiber ⇒ Object
readonly
Returns the value of attribute access_fiber.
-
#access_thread ⇒ Object
readonly
Returns the value of attribute access_thread.
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#created_fiber ⇒ Object
readonly
Returns the value of attribute created_fiber.
-
#created_thread ⇒ Object
readonly
Returns the value of attribute created_thread.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(object, created_fiber, created_thread) ⇒ Offense
constructor
A new instance of Offense.
- #to_s ⇒ Object
Constructor Details
#initialize(object, created_fiber, created_thread) ⇒ Offense
Returns a new instance of Offense.
10 11 12 13 14 15 16 17 |
# File 'lib/thread_safety/offense.rb', line 10 def initialize(object, created_fiber, created_thread) @object = object @created_fiber = created_fiber @created_thread = created_thread @access_fiber = Fiber.current @access_thread = Thread.current @backtrace = caller_locations(CALLER_SKIP).freeze end |
Instance Attribute Details
#access_fiber ⇒ Object (readonly)
Returns the value of attribute access_fiber.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def access_fiber @access_fiber end |
#access_thread ⇒ Object (readonly)
Returns the value of attribute access_thread.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def access_thread @access_thread end |
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def backtrace @backtrace end |
#created_fiber ⇒ Object (readonly)
Returns the value of attribute created_fiber.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def created_fiber @created_fiber end |
#created_thread ⇒ Object (readonly)
Returns the value of attribute created_thread.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def created_thread @created_thread end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/thread_safety/offense.rb', line 5 def object @object end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/thread_safety/offense.rb', line 19 def to_s "#<ThreadSafety::Offense object=#{object} created_thread=#{created_thread} access_thread=#{access_thread} backtrace=#{backtrace[0]}>" end |