Module: Schema::Validation::NilAttributes::Validator

Defined in:
lib/schema/validation/nil_attributes.rb

Class Method Summary collapse

Class Method Details

.call(schema, errors = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/schema/validation/nil_attributes.rb', line 9

def self.call(schema, errors=nil)
  errors ||= []
  schema.class.attribute_names.each do |attribute|
    if schema.public_send(attribute).nil?
      errors << "#{attribute} can't be nil"
    end
  end
  errors.empty?
end