Class: SmartCore::Types::Primitive::Validator::Result Private
- Inherits:
-
Object
- Object
- SmartCore::Types::Primitive::Validator::Result
- Defined in:
- lib/smart_core/types/primitive/validator/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
- NO_INVARIANT_ERRORS =
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.
[].freeze
Instance Attribute Summary collapse
- #checked_value ⇒ Any (also: #value) readonly
- #invariant_errors ⇒ Array<String> (also: #errors, #error_codes) readonly
- #is_valid_check ⇒ Boolean (also: #valid_check?) readonly
- #type ⇒ SmartCore::Types::Primitive readonly
Instance Method Summary collapse
- #failure? ⇒ Boolean
- #initialize(type, checked_value, is_valid_check, invariant_errors = NO_INVARIANT_ERRORS.dup) ⇒ void constructor private
- #success? ⇒ Boolean
- #valid_invariants? ⇒ Boolean
Constructor Details
#initialize(type, checked_value, is_valid_check, invariant_errors = NO_INVARIANT_ERRORS.dup) ⇒ 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.
48 49 50 51 52 53 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 48 def initialize(type, checked_value, is_valid_check, invariant_errors = NO_INVARIANT_ERRORS.dup) @type = type @checked_value = checked_value @is_valid_check = is_valid_check @invariant_errors = invariant_errors.tap(&:freeze) end |
Instance Attribute Details
#checked_value ⇒ Any (readonly) Also known as: value
29 30 31 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 29 def checked_value @checked_value end |
#invariant_errors ⇒ Array<String> (readonly) Also known as: errors, error_codes
36 37 38 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 36 def invariant_errors @invariant_errors end |
#is_valid_check ⇒ Boolean (readonly) Also known as: valid_check?
22 23 24 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 22 def is_valid_check @is_valid_check end |
#type ⇒ SmartCore::Types::Primitive (readonly)
16 17 18 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 16 def type @type end |
Instance Method Details
#failure? ⇒ Boolean
75 76 77 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 75 def failure? !success? end |
#success? ⇒ Boolean
67 68 69 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 67 def success? valid_check? && invariant_errors.empty? end |
#valid_invariants? ⇒ Boolean
59 60 61 |
# File 'lib/smart_core/types/primitive/validator/result.rb', line 59 def valid_invariants? invariant_errors.empty? end |