Class: OpenActive::Validators::BaseModelValidator

Inherits:
BaseValidator
  • Object
show all
Defined in:
lib/openactive/validators/base_model_validator.rb

Instance Method Summary collapse

Methods inherited from BaseValidator

#coerce, get_validator

Instance Method Details

#run(value) ⇒ Boolean

Run validation on the given value.

Parameters:

  • value (mixed)

    The value to validate.

Returns:

  • (Boolean)

    Whether validation passes or not.



8
9
10
11
12
13
14
# File 'lib/openactive/validators/base_model_validator.rb', line 8

def run(value)
  # With BaseModelValidator we are a bit more relaxed
  # in terms of checking the class name.
  # We allow the class to be an instanceof BaseModel
  # Or to be a sub class (BaseModel is one of its parent)
  value.is_a?(OpenActive::JsonLdModel)
end