Class: RiderServer::Validate::Base

Inherits:
Object
  • Object
show all
Includes:
PredicateLogic
Defined in:
lib/rider_server/validate/base.rb

Direct Known Subclasses

Array, Boolean, Hash, Integer, String, Symbol

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PredicateLogic

#add_predicate, #check_predicates

Class Method Details

.validate(data) ⇒ Object



11
12
13
# File 'lib/rider_server/validate/base.rb', line 11

def self.validate(data)
  new.validate(data)
end

Instance Method Details

#fail(value, loc, reason) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rider_server/validate/base.rb', line 19

def fail(value, loc, reason)
  if loc == ""
    raise ValidationError, "#{value.inspect}, #{reason}"
  else
    raise ValidationError, "#{value.inspect}, found at #{loc} #{reason}"
  end
end

#validate(data) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/rider_server/validate/base.rb', line 15

def validate(data)
  raise NotImplementedError
end