Module: Roart::Validations

Included in:
Ticket
Defined in:
lib/roart/validations.rb

Defined Under Namespace

Modules: ClassMethods Classes: Validators

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



57
58
59
60
# File 'lib/roart/validations.rb', line 57

def self.included(model)
  model.extend ClassMethods

end

Instance Method Details

#errorsObject



224
225
226
# File 'lib/roart/validations.rb', line 224

def errors
  @errors ||= Errors.new(self)
end

#invalid?Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/roart/validations.rb', line 220

def invalid?
  !valid?
end

#valid?Boolean

Returns:

  • (Boolean)


215
216
217
218
# File 'lib/roart/validations.rb', line 215

def valid?
  validator.validate self
  self.errors.size == 0
end

#validatorObject



211
212
213
# File 'lib/roart/validations.rb', line 211

def validator
  self.class.validator
end