Class: TRuby::InferredType
- Inherits:
-
Object
- Object
- TRuby::InferredType
- Defined in:
- lib/t_ruby/type_inferencer.rb
Overview
Represents an inferred type with confidence score
Constant Summary collapse
- HIGH =
Confidence levels
1.0- MEDIUM =
0.7
- LOW =
0.4
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #high_confidence? ⇒ Boolean
-
#initialize(type:, confidence: HIGH, source: :unknown, location: nil) ⇒ InferredType
constructor
A new instance of InferredType.
- #low_confidence? ⇒ Boolean
- #medium_confidence? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(type:, confidence: HIGH, source: :unknown, location: nil) ⇒ InferredType
Returns a new instance of InferredType.
13 14 15 16 17 18 |
# File 'lib/t_ruby/type_inferencer.rb', line 13 def initialize(type:, confidence: HIGH, source: :unknown, location: nil) @type = type @confidence = confidence @source = source @location = location end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
6 7 8 |
# File 'lib/t_ruby/type_inferencer.rb', line 6 def confidence @confidence end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
6 7 8 |
# File 'lib/t_ruby/type_inferencer.rb', line 6 def location @location end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/t_ruby/type_inferencer.rb', line 6 def source @source end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/t_ruby/type_inferencer.rb', line 6 def type @type end |
Instance Method Details
#high_confidence? ⇒ Boolean
24 25 26 |
# File 'lib/t_ruby/type_inferencer.rb', line 24 def high_confidence? @confidence >= HIGH end |
#low_confidence? ⇒ Boolean
32 33 34 |
# File 'lib/t_ruby/type_inferencer.rb', line 32 def low_confidence? @confidence < MEDIUM end |
#medium_confidence? ⇒ Boolean
28 29 30 |
# File 'lib/t_ruby/type_inferencer.rb', line 28 def medium_confidence? @confidence >= MEDIUM && @confidence < HIGH end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/t_ruby/type_inferencer.rb', line 20 def to_s @type end |