Class: FiberAudit::Static::CallSite
- Inherits:
-
Data
- Object
- Data
- FiberAudit::Static::CallSite
- Defined in:
- lib/fiber_audit/static/call_site.rb
Overview
CallSite represents a single method call extracted from source code. Carries exactly 13 fields as specified in the remediation plan.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#enclosing_symbol ⇒ Object
readonly
Returns the value of attribute enclosing_symbol.
-
#execution_context ⇒ Object
readonly
Returns the value of attribute execution_context.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#nesting ⇒ Object
readonly
Returns the value of attribute nesting.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#receiver_constant ⇒ Object
readonly
Returns the value of attribute receiver_constant.
-
#receiver_source ⇒ Object
readonly
Returns the value of attribute receiver_source.
-
#resolution ⇒ Object
readonly
Returns the value of attribute resolution.
Instance Method Summary collapse
-
#initialize(path:, line:, column:, receiver_source:, receiver_constant:, method_name:, arguments:, enclosing_symbol:, nesting:, execution_context:, resolution:, confidence:) ⇒ CallSite
constructor
Override initialize to ensure proper contract: - method_name normalized to Symbol or nil - confidence validated via Confidence.coerce - arguments and nesting frozen to prevent caller mutation.
-
#location ⇒ Object
Returns a Location object for this call site.
-
#method_name_sym ⇒ Object
Returns method_name as a Symbol or nil (convenience accessor).
Constructor Details
#initialize(path:, line:, column:, receiver_source:, receiver_constant:, method_name:, arguments:, enclosing_symbol:, nesting:, execution_context:, resolution:, confidence:) ⇒ CallSite
Override initialize to ensure proper contract:
- method_name normalized to Symbol or nil
- confidence validated via Confidence.coerce
- arguments and nesting frozen to prevent caller mutation
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fiber_audit/static/call_site.rb', line 20 def initialize( path:, line:, column:, receiver_source:, receiver_constant:, method_name:, arguments:, enclosing_symbol:, nesting:, execution_context:, resolution:, confidence: ) # Normalize method_name to Symbol if it's a String, preserve nil method_name_value = case method_name when String method_name.to_sym when Symbol, nil method_name else raise ArgumentError, "method_name must be String, Symbol, or nil, got #{method_name.class}" end # Validate confidence via Confidence.coerce validated_confidence = Confidence.coerce(confidence) # Freeze duplicates of mutable collections to prevent caller mutation frozen_arguments = arguments.dup.freeze frozen_nesting = nesting.dup.freeze super( path: path, line: line, column: column, receiver_source: receiver_source, receiver_constant: receiver_constant, method_name: method_name_value, arguments: frozen_arguments, enclosing_symbol: enclosing_symbol, nesting: frozen_nesting, execution_context: execution_context, resolution: resolution, confidence: validated_confidence ) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def arguments @arguments end |
#column ⇒ Object (readonly)
Returns the value of attribute column
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def column @column end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def confidence @confidence end |
#enclosing_symbol ⇒ Object (readonly)
Returns the value of attribute enclosing_symbol
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def enclosing_symbol @enclosing_symbol end |
#execution_context ⇒ Object (readonly)
Returns the value of attribute execution_context
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def execution_context @execution_context end |
#line ⇒ Object (readonly)
Returns the value of attribute line
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def line @line end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def method_name @method_name end |
#nesting ⇒ Object (readonly)
Returns the value of attribute nesting
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def nesting @nesting end |
#path ⇒ Object (readonly)
Returns the value of attribute path
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def path @path end |
#receiver_constant ⇒ Object (readonly)
Returns the value of attribute receiver_constant
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def receiver_constant @receiver_constant end |
#receiver_source ⇒ Object (readonly)
Returns the value of attribute receiver_source
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def receiver_source @receiver_source end |
#resolution ⇒ Object (readonly)
Returns the value of attribute resolution
10 11 12 |
# File 'lib/fiber_audit/static/call_site.rb', line 10 def resolution @resolution end |
Instance Method Details
#location ⇒ Object
Returns a Location object for this call site
61 62 63 |
# File 'lib/fiber_audit/static/call_site.rb', line 61 def location FiberAudit::Location.new(path: path, line: line, column: column) end |
#method_name_sym ⇒ Object
Returns method_name as a Symbol or nil (convenience accessor)
66 67 68 |
# File 'lib/fiber_audit/static/call_site.rb', line 66 def method_name_sym method_name end |