Module: ActiveMerchant::Validateable

Included in:
Billing::CreditCard
Defined in:
lib/validateable.rb

Overview

Implements the standard ActiveRecord stuff for non-AR classes

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#errorsObject



18
19
20
# File 'lib/validateable.rb', line 18

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

#initialize(attributes = {}) ⇒ Object



14
15
16
# File 'lib/validateable.rb', line 14

def initialize(attributes = {})
  self.attributes = attributes
end

#valid?Boolean

:nodoc:

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
# File 'lib/validateable.rb', line 5

def valid?
  errors.clear

  before_validate if respond_to?(:before_validate)
  validate if respond_to?(:validate)

  errors.empty?
end