module Aba::Validations::ClassMethods
Public Instance Methods
validates_account_number(attribute)
click to toggle source
# File lib/aba/validations.rb, line 97 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 101 def validates_becs(attribute) add_validation_attribute(attribute, :becs) end
validates_bsb(attribute, options = {})
click to toggle source
# File lib/aba/validations.rb, line 80 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 105 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 93 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 89 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 85 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 74 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 113 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 109 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 119 def add_validation_attribute(attribute, type, param = true) @_validations[attribute] = {} unless @_validations[attribute] @_validations[attribute][type] = param end