Module: Kangaru::Validatable

Extended by:
Concern
Included in:
Configurator
Defined in:
lib/kangaru/concerns/validatable.rb

Instance Method Summary collapse

Methods included from Concern

append_features, class_methods, included

Instance Method Details

#errorsObject



16
17
18
# File 'lib/kangaru/concerns/validatable.rb', line 16

def errors
  @errors ||= []
end

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
# File 'lib/kangaru/concerns/validatable.rb', line 24

def valid?
  validate

  errors.empty?
end

#validateObject



20
21
22
# File 'lib/kangaru/concerns/validatable.rb', line 20

def validate
  model_validator.validate!(**self.class.validation_rules)
end