Class: Dbviewer::Validator::Sql::ValidationResult
- Inherits:
-
Struct
- Object
- Struct
- Dbviewer::Validator::Sql::ValidationResult
- Defined in:
- lib/dbviewer/validator/sql/validation_result.rb
Overview
Validation result object to encapsulate validation state and errors This provides a structured way to return validation results with clear success/failure states and associated error messages.
Instance Attribute Summary collapse
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#normalized_sql ⇒ Object
Returns the value of attribute normalized_sql.
-
#valid? ⇒ Object
Returns the value of attribute valid?.
Class Method Summary collapse
-
.failure(error_message) ⇒ ValidationResult
Create a failed validation result.
-
.success(normalized_sql) ⇒ ValidationResult
Create a successful validation result.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
Check if the validation failed.
-
#success? ⇒ Boolean
Check if the validation was successful.
Instance Attribute Details
#error_message ⇒ Object
Returns the value of attribute error_message
9 10 11 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 9 def end |
#normalized_sql ⇒ Object
Returns the value of attribute normalized_sql
9 10 11 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 9 def normalized_sql @normalized_sql end |
#valid? ⇒ Object
Returns the value of attribute valid?
9 10 11 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 9 def valid? @valid? end |
Class Method Details
.failure(error_message) ⇒ ValidationResult
Create a failed validation result
32 33 34 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 32 def self.failure() new(valid?: false, error_message: ) end |
.success(normalized_sql) ⇒ ValidationResult
Create a successful validation result
25 26 27 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 25 def self.success(normalized_sql) new(valid?: true, normalized_sql: normalized_sql) end |
Instance Method Details
#failure? ⇒ Boolean
Check if the validation failed
18 19 20 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 18 def failure? !valid? end |
#success? ⇒ Boolean
Check if the validation was successful
12 13 14 |
# File 'lib/dbviewer/validator/sql/validation_result.rb', line 12 def success? valid? end |