class Schemas::Types::TypeWithValidator

Public Class Methods

new(type, validator) click to toggle source
# File lib/schemas/types/type_with_validator.rb, line 4
def initialize(type, validator)
  @type = type
  @validator = validator
end

Public Instance Methods

errors(input) click to toggle source
# File lib/schemas/types/type_with_validator.rb, line 9
def errors(input)
  type_errors = @type.errors(input)
  return type_errors if type_errors.any?

  parsed = @type.parse(input)
  @validator.errors(parsed)
end
parse(input) click to toggle source
# File lib/schemas/types/type_with_validator.rb, line 17
def parse(input)
  @type.parse(input)
end