Method: Scimitar::Schema::Attribute#valid_simple_type?

Defined in:
app/models/scimitar/schema/attribute.rb

#valid_simple_type?(value) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
98
99
100
101
102
103
104
# File 'app/models/scimitar/schema/attribute.rb', line 95

def valid_simple_type?(value)
  if multiValued
    valid = value.is_a?(Array) && value.all? { |v| simple_type?(v) }
    errors.add(self.name, "or one of its elements has the wrong type. It has to be an array of #{self.type}s.") unless valid
  else
    valid = simple_type?(value)
    errors.add(self.name, "has the wrong type. It has to be a(n) #{self.type}.") unless valid
  end
  valid
end