Class: Ast::Merge::MatchRefinerBase::MatchResult
- Inherits:
-
Struct
- Object
- Struct
- Ast::Merge::MatchRefinerBase::MatchResult
- Defined in:
- lib/ast/merge/match_refiner_base.rb
Overview
Result of a match refinement operation.
Instance Attribute Summary collapse
-
#dest_node ⇒ Object
readonly
The node from the destination.
-
#metadata ⇒ Hash
readonly
Optional metadata about the match.
-
#score ⇒ Float
readonly
Match score between 0.0 and 1.0.
-
#template_node ⇒ Object
readonly
The node from the template.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compare match results by score for sorting.
-
#high_confidence?(threshold: 0.8) ⇒ Boolean
Check if this is a high-confidence match.
Instance Attribute Details
#dest_node ⇒ Object (readonly)
Returns The node from the destination.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ast/merge/match_refiner_base.rb', line 140 MatchResult = Struct.new(:template_node, :dest_node, :score, :metadata, keyword_init: true) do # Check if this is a high-confidence match. # # @param threshold [Float] Minimum score for high confidence (default: 0.8) # @return [Boolean] def high_confidence?(threshold: 0.8) score >= threshold end # Compare match results by score for sorting. # # @param other [MatchResult] # @return [Integer] -1, 0, or 1 def <=>(other) score <=> other.score end end |
#metadata ⇒ Hash (readonly)
Returns Optional metadata about the match.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ast/merge/match_refiner_base.rb', line 140 MatchResult = Struct.new(:template_node, :dest_node, :score, :metadata, keyword_init: true) do # Check if this is a high-confidence match. # # @param threshold [Float] Minimum score for high confidence (default: 0.8) # @return [Boolean] def high_confidence?(threshold: 0.8) score >= threshold end # Compare match results by score for sorting. # # @param other [MatchResult] # @return [Integer] -1, 0, or 1 def <=>(other) score <=> other.score end end |
#score ⇒ Float (readonly)
Returns Match score between 0.0 and 1.0.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ast/merge/match_refiner_base.rb', line 140 MatchResult = Struct.new(:template_node, :dest_node, :score, :metadata, keyword_init: true) do # Check if this is a high-confidence match. # # @param threshold [Float] Minimum score for high confidence (default: 0.8) # @return [Boolean] def high_confidence?(threshold: 0.8) score >= threshold end # Compare match results by score for sorting. # # @param other [MatchResult] # @return [Integer] -1, 0, or 1 def <=>(other) score <=> other.score end end |
#template_node ⇒ Object (readonly)
Returns The node from the template.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ast/merge/match_refiner_base.rb', line 140 MatchResult = Struct.new(:template_node, :dest_node, :score, :metadata, keyword_init: true) do # Check if this is a high-confidence match. # # @param threshold [Float] Minimum score for high confidence (default: 0.8) # @return [Boolean] def high_confidence?(threshold: 0.8) score >= threshold end # Compare match results by score for sorting. # # @param other [MatchResult] # @return [Integer] -1, 0, or 1 def <=>(other) score <=> other.score end end |
Instance Method Details
#<=>(other) ⇒ Integer
Compare match results by score for sorting.
153 154 155 |
# File 'lib/ast/merge/match_refiner_base.rb', line 153 def <=>(other) score <=> other.score end |
#high_confidence?(threshold: 0.8) ⇒ Boolean
Check if this is a high-confidence match.
145 146 147 |
# File 'lib/ast/merge/match_refiner_base.rb', line 145 def high_confidence?(threshold: 0.8) score >= threshold end |