Method: SmartCore::Types::Primitive::Validator#validate
- Defined in:
- lib/smart_core/types/primitive/validator.rb
#validate(value) ⇒ SmartCore::Types::Primitive::Validator::Result
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.
77 78 79 80 81 82 83 |
# File 'lib/smart_core/types/primitive/validator.rb', line 77 def validate(value) checker_result = type_checker.call(value, type.runtime_attributes) # => Boolean return Result.new(type, value, checker_result) unless checker_result invariant_result = invariant_control.check(value, type.runtime_attributes) invariant_errors = invariant_result.invariant_errors.map { |error| "#{type.name}.#{error}" } Result.new(type, value, checker_result, invariant_errors) end |