Class: SecureKeys::Validation::ValidationIssue
- Inherits:
-
Object
- Object
- SecureKeys::Validation::ValidationIssue
- Defined in:
- lib/validation/validation_issue.rb
Overview
Represents a single issue detected during secret validation
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#recommendation ⇒ Object
readonly
Returns the value of attribute recommendation.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(severity:, type:, message:, recommendation:) ⇒ ValidationIssue
constructor
Initialize a new validation issue.
-
#to_h ⇒ Hash
Returns a hash representation of the issue.
-
#to_s ⇒ String
Returns a string representation of the issue, including the recommendation if present.
Constructor Details
#initialize(severity:, type:, message:, recommendation:) ⇒ ValidationIssue
Initialize a new validation issue
14 15 16 17 18 19 |
# File 'lib/validation/validation_issue.rb', line 14 def initialize(severity:, type:, message:, recommendation:) @severity = severity @type = type @message = @recommendation = recommendation end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/validation/validation_issue.rb', line 7 def @message end |
#recommendation ⇒ Object (readonly)
Returns the value of attribute recommendation.
7 8 9 |
# File 'lib/validation/validation_issue.rb', line 7 def recommendation @recommendation end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
7 8 9 |
# File 'lib/validation/validation_issue.rb', line 7 def severity @severity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/validation/validation_issue.rb', line 7 def type @type end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of the issue
31 32 33 34 35 36 37 38 |
# File 'lib/validation/validation_issue.rb', line 31 def to_h { severity:, type:, message:, recommendation:, } end |
#to_s ⇒ String
Returns a string representation of the issue, including the recommendation if present
23 24 25 26 27 |
# File 'lib/validation/validation_issue.rb', line 23 def to_s text = "#{severity_icon} #{severity.upcase}: #{}" text += "\n\t\t💡 #{recommendation}" if recommendation text end |