Class: SmartCore::Schema::Checker::Rules::Requirement::Result Private
- Inherits:
-
Object
- Object
- SmartCore::Schema::Checker::Rules::Requirement::Result
- Defined in:
- lib/smart_core/schema/checker/rules/requirement/result.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- ERROR_CODE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
:required_key_not_found
Instance Attribute Summary collapse
- #error ⇒ Symbol, NilClass readonly private
- #key ⇒ String readonly private
- #message ⇒ String, NilClass readonly private
- #verifiable_hash ⇒ SmartCore::Schema::Checker::VerifiableHash readonly private
Instance Method Summary collapse
- #failure? ⇒ Boolean private
- #initialize(key, verifiable_hash, required:, key_exists:) ⇒ void constructor private
- #key_exists? ⇒ Boolean private
- #optional? ⇒ Boolean private
- #required? ⇒ Boolean private
- #success? ⇒ Boolean private
Constructor Details
#initialize(key, verifiable_hash, required:, key_exists:) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 44 def initialize(key, verifiable_hash, required:, key_exists:) @key = key @verifiable_hash = verifiable_hash @required = required @optional = !required @key_exists = key_exists @success = required ? key_exists : true @failure = required ? !key_exists : false @error = (required && !key_exists) ? ERROR_CODE : nil @message = (required && !key_exists) ? "Required key :#{key} not found" : nil end |
Instance Attribute Details
#error ⇒ Symbol, NilClass (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 28 def error @error end |
#key ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 16 def key @key end |
#message ⇒ String, NilClass (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 34 def @message end |
#verifiable_hash ⇒ SmartCore::Schema::Checker::VerifiableHash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 22 def verifiable_hash @verifiable_hash end |
Instance Method Details
#failure? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
68 69 70 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 68 def failure? @failure end |
#key_exists? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
76 77 78 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 76 def key_exists? @key_exists end |
#optional? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
84 85 86 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 84 def optional? @optional end |
#required? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
92 93 94 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 92 def required? @required end |
#success? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 |
# File 'lib/smart_core/schema/checker/rules/requirement/result.rb', line 60 def success? @success end |