Class: WhyChain::DispatchTrace
- Inherits:
-
Object
- Object
- WhyChain::DispatchTrace
- Defined in:
- lib/why_chain/dispatch_trace.rb
Overview
Immutable value object for traced dispatch data.
Instance Attribute Summary collapse
-
#lookup_chain ⇒ Object
readonly
Returns the value of attribute lookup_chain.
-
#next_super_owner ⇒ Object
readonly
Returns the value of attribute next_super_owner.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#source_location ⇒ Object
readonly
Returns the value of attribute source_location.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
-
#initialize(lookup_chain:, owner:, next_super_owner:, source_location: nil, steps: []) ⇒ DispatchTrace
constructor
A new instance of DispatchTrace.
- #to_h ⇒ Object
Constructor Details
#initialize(lookup_chain:, owner:, next_super_owner:, source_location: nil, steps: []) ⇒ DispatchTrace
Returns a new instance of DispatchTrace.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/why_chain/dispatch_trace.rb', line 8 def initialize( lookup_chain:, owner:, next_super_owner:, source_location: nil, steps: [] ) @lookup_chain = lookup_chain @owner = owner @next_super_owner = next_super_owner @source_location = source_location @steps = steps.map { |step| coerce_step(step) } end |
Instance Attribute Details
#lookup_chain ⇒ Object (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_owner ⇒ Object (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 |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
6 7 8 |
# File 'lib/why_chain/dispatch_trace.rb', line 6 def owner @owner end |
#source_location ⇒ Object (readonly)
Returns the value of attribute source_location.
6 7 8 |
# File 'lib/why_chain/dispatch_trace.rb', line 6 def source_location @source_location end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
6 7 8 |
# File 'lib/why_chain/dispatch_trace.rb', line 6 def steps @steps end |
Instance Method Details
#to_h ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/why_chain/dispatch_trace.rb', line 22 def to_h { lookup_chain: lookup_chain, owner: owner, next_super_owner: next_super_owner, source_location: source_location, steps: steps.map(&:to_h) } end |