class SimpleJSONSchema::Validators::Base

Public Instance Methods

valid(scope) click to toggle source
# File lib/simple_json_schema/validators/base.rb, line 6
def valid(scope)
  cast(scope) if scope.options[:cast] == true
  validate(scope)
end

Private Instance Methods

cast(scope) click to toggle source
# File lib/simple_json_schema/validators/base.rb, line 17
def cast(scope)
  value = casting(scope.value)
  scope.value = value unless value.nil? && scope.value != value
end
casting(value) click to toggle source
# File lib/simple_json_schema/validators/base.rb, line 22
def casting(value); end
validate(scope) click to toggle source
# File lib/simple_json_schema/validators/base.rb, line 13
def validate(scope)
  raise NotImplementedError
end