Module: Brcobranca::Validations

Included in:
Boleto::Base, Remessa::Base, Remessa::Pagamento
Defined in:
lib/brcobranca/validations.rb

Overview

Métodos auxiliares de validação para evitar ActiveSupport e ActiveModel com mínimo de impacto nas definições das validações existentes

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


12
13
14
# File 'lib/brcobranca/validations.rb', line 12

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#errorsObject


56
57
58
# File 'lib/brcobranca/validations.rb', line 56

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

#invalid?Boolean

Returns:

  • (Boolean)

72
73
74
# File 'lib/brcobranca/validations.rb', line 72

def invalid?
  !valid?
end

#valid?Boolean

Returns:

  • (Boolean)

60
61
62
63
64
65
66
67
68
69
70
# File 'lib/brcobranca/validations.rb', line 60

def valid?
  #puts "** #{self.class}"
  #puts "** #{self.class.superclass}"
  all_valid = true
  all_valid = false if !check_eachs
  all_valid = false if !check_presences
  all_valid = false if !check_numericals
  all_valid = false if !check_lengths
  all_valid = false if !check_inclusions
  return all_valid
end