Class: ActiveModel::Validations::BaseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, options = {}) ⇒ BaseValidator

Returns a new instance of BaseValidator.



5
6
7
8
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 5

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

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 3

def attributes
  @attributes
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 3

def options
  @options
end

Class Method Details

.kindObject



17
18
19
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 17

def self.kind
  @kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
13
14
15
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 10

def ==(other)
  class_equality     = self.class      == other.class
  attribute_equality = self.attributes == other.attributes
  options_equality   = self.options    == other.options
  class_equality && attribute_equality && options_equality
end

#kindObject



21
22
23
# File 'lib/client_side_validations/rails_2/active_record/active_model/validations/base.rb', line 21

def kind
  self.class.kind
end