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



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

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

Instance Method Details

#errorsObject



48
49
50
# File 'lib/brcobranca/validations.rb', line 48

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

#invalid?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/brcobranca/validations.rb', line 64

def invalid?
  !valid?
end

#valid?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
61
62
# File 'lib/brcobranca/validations.rb', line 52

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