Method: Scimitar::Schema::Attribute#valid?
- Defined in:
- app/models/scimitar/schema/attribute.rb
#valid?(value) ⇒ Boolean
Validates a value against this attribute object. For simple attributes, it checks if blank is valid or not and if the type matches. For complex attributes, it delegates it to the valid? method of the complex type schema.
If the value is not valid, validation message(s) are added to the #errors attribute of this object.
value-
Value to check.
Returns true if value is valid for this attribute, else false.
67 68 69 70 71 72 73 74 75 76 |
# File 'app/models/scimitar/schema/attribute.rb', line 67 def valid?(value) return valid_blank? if value.blank? && !value.is_a?(FalseClass) if type == 'complex' return all_valid?(complexType, value) if multiValued valid_complex_type?(value) else valid_simple_type?(value) end end |