Class: WhyChain::DispatchTrace

Inherits:
Object
  • Object
show all
Defined in:
lib/why_chain/dispatch_trace.rb

Overview

Immutable value object for traced dispatch data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lookup_chain:, owner:, next_super_owner:) ⇒ DispatchTrace

Returns a new instance of DispatchTrace.



8
9
10
11
12
13
14
15
16
# File 'lib/why_chain/dispatch_trace.rb', line 8

def initialize(
  lookup_chain:,
  owner:,
  next_super_owner:
)
  @lookup_chain = lookup_chain
  @owner = owner
  @next_super_owner = next_super_owner
end

Instance Attribute Details

#lookup_chainObject (readonly)

Returns the value of attribute lookup_chain.



6
7
8
# File 'lib/why_chain/dispatch_trace.rb', line 6

def lookup_chain
  @lookup_chain
end

#next_super_ownerObject (readonly)

Returns the value of attribute next_super_owner.



6
7
8
# File 'lib/why_chain/dispatch_trace.rb', line 6

def next_super_owner
  @next_super_owner
end

#ownerObject (readonly)

Returns the value of attribute owner.



6
7
8
# File 'lib/why_chain/dispatch_trace.rb', line 6

def owner
  @owner
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
# File 'lib/why_chain/dispatch_trace.rb', line 18

def to_h
  {
    lookup_chain: lookup_chain,
    owner: owner,
    next_super_owner: next_super_owner
  }
end