Class: Assent::Validate

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
lib/assent/validations/validator.rb

Instance Method Summary collapse

Methods included from Options

included, options

Constructor Details

#initialize(field, value, rules, errors) ⇒ Validate

Returns a new instance of Validate.



8
9
10
11
12
13
# File 'lib/assent/validations/validator.rb', line 8

def initialize(field, value, rules, errors)
  @field = field
  @value = value
  @rules = rules
  @errors = errors
end

Instance Method Details

#validateObject

Validate method that checks all the validations for a single field



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/assent/validations/validator.rb', line 15

def validate
  required
  accepted

  return if blank?

  date
  ip

  @errors
end