Class: Mongoa::MongoMapper::Matchers::ValidateBase

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoa/mongo_mapper/validations/validate_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ ValidateBase

Returns a new instance of ValidateBase.



7
8
9
# File 'lib/mongoa/mongo_mapper/validations/validate_base.rb', line 7

def initialize(attribute)
  @attribute = attribute
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



5
6
7
# File 'lib/mongoa/mongo_mapper/validations/validate_base.rb', line 5

def attribute
  @attribute
end

Instance Method Details

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/mongoa/mongo_mapper/validations/validate_base.rb', line 11

def matches?(subject)
  @subject = subject
  @validation = find_validation
end

#validation_typeObject



16
17
18
# File 'lib/mongoa/mongo_mapper/validations/validate_base.rb', line 16

def validation_type
  raise "Redefine in the subclass"
end

#validator_class_nameObject



20
21
22
# File 'lib/mongoa/mongo_mapper/validations/validate_base.rb', line 20

def validator_class_name
  raise "Redefine in the subclass"
end