Module: Necropsy::CallSiteIdentity
- Defined in:
- lib/necropsy/call_site_identity.rb
Constant Summary collapse
- VERSION =
1- PREFIX =
"call:v#{VERSION}".freeze
- SOURCE_ROLES =
%i[ call initialize symbol_reference symbol_to_proc super alias_target delegate_target delegate_message ].freeze
- DERIVATIONS =
%i[module_function rta_implicit].freeze
Class Method Summary collapse
- .derived_id(parent_call_site_id:, derivation:, caller_definition_id:, message:, discriminator: nil) ⇒ Object
- .legacy_id(caller_definition_id:, message:, receiver_kind:, receiver_name:, file:, line:, test:, dynamic:, metadata:) ⇒ Object
- .source_id(caller_definition_id:, relative_path:, role:, message:, structural_digest:, ordinal:) ⇒ Object
Class Method Details
.derived_id(parent_call_site_id:, derivation:, caller_definition_id:, message:, discriminator: nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/necropsy/call_site_identity.rb', line 30 def derived_id(parent_call_site_id:, derivation:, caller_definition_id:, message:, discriminator: nil) derivation = derivation.to_sym raise ArgumentError, "invalid call site derivation: #{derivation.inspect}" unless DERIVATIONS.include?(derivation) payload = [ 'derived', derivation.to_s, parent_call_site_id.to_s, caller_definition_id.to_s, .to_s ] payload << discriminator.to_s unless discriminator.nil? identifier(*payload) end |
.legacy_id(caller_definition_id:, message:, receiver_kind:, receiver_name:, file:, line:, test:, dynamic:, metadata:) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/necropsy/call_site_identity.rb', line 41 def legacy_id(caller_definition_id:, message:, receiver_kind:, receiver_name:, file:, line:, test:, dynamic:, metadata:) identifier( 'legacy', caller_definition_id.to_s, .to_s, receiver_kind.to_s, receiver_name&.to_s, file.to_s, line, test, dynamic, ) end |
.source_id(caller_definition_id:, relative_path:, role:, message:, structural_digest:, ordinal:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/necropsy/call_site_identity.rb', line 17 def source_id(caller_definition_id:, relative_path:, role:, message:, structural_digest:, ordinal:) role = role.to_sym raise ArgumentError, "invalid call site role: #{role.inspect}" unless SOURCE_ROLES.include?(role) ordinal = Integer(ordinal) raise ArgumentError, 'call site ordinal must be positive' unless ordinal.positive? identifier( 'source', caller_definition_id.to_s, relative_path.to_s, role.to_s, .to_s, structural_digest.to_s, ordinal ) end |