module Aba::Validations::ClassMethods

Public Instance Methods

validates_account_number(attribute) click to toggle source
# File lib/aba/validations.rb, line 99
def validates_account_number(attribute)
  add_validation_attribute(attribute, :account_number)
end
validates_becs(attribute) click to toggle source
# File lib/aba/validations.rb, line 103
def validates_becs(attribute)
  add_validation_attribute(attribute, :becs)
end
validates_bsb(attribute, options = {}) click to toggle source
# File lib/aba/validations.rb, line 82
def validates_bsb(attribute, options = {})
  options[:allow_blank] ||= false
  add_validation_attribute(attribute, :bsb, options[:allow_blank])
end
validates_indicator(attribute) click to toggle source
# File lib/aba/validations.rb, line 107
def validates_indicator(attribute)
  add_validation_attribute(attribute, :indicator)
end
validates_integer(attribute, signed = true) click to toggle source
# File lib/aba/validations.rb, line 95
def validates_integer(attribute, signed = true)
  add_validation_attribute(attribute, :integer, signed)
end
validates_length(attribute, length) click to toggle source
# File lib/aba/validations.rb, line 91
def validates_length(attribute, length)
  add_validation_attribute(attribute, :length, length)
end
validates_max_length(attribute, length) click to toggle source
# File lib/aba/validations.rb, line 87
def validates_max_length(attribute, length)
  add_validation_attribute(attribute, :max_length, length)
end
validates_presence_of(*attributes) click to toggle source
# File lib/aba/validations.rb, line 76
def validates_presence_of(*attributes)
  attributes.each do |a|
    add_validation_attribute(a, :presence)
  end
end
validates_return_code(attribute) click to toggle source
# File lib/aba/validations.rb, line 115
def validates_return_code(attribute)
  add_validation_attribute(attribute, :integer, :return_code)
end
validates_transaction_code(attribute) click to toggle source
# File lib/aba/validations.rb, line 111
def validates_transaction_code(attribute)
  add_validation_attribute(attribute, :transaction_code)
end

Private Instance Methods

add_validation_attribute(attribute, type, param = true) click to toggle source
# File lib/aba/validations.rb, line 121
def add_validation_attribute(attribute, type, param = true)
  @_validations[attribute] = {} unless @_validations[attribute]
  @_validations[attribute][type] = param
end