Class: ActiveModel::Validations::WithSchemaValidator

Inherits:
EachValidator
  • Object
show all
Includes:
SchemaHelperMethods
Defined in:
lib/password_schema_validator/with_schema_validator.rb

Constant Summary

Constants included from SchemaHelperMethods

SchemaHelperMethods::RESERVED_OPTIONS

Instance Method Summary collapse

Methods included from SchemaHelperMethods

#allowed_special_chareters, #dictionary, #digits, #discarded_words, #invalid_key_error, #invalid_value_type, #lower_case, #match_against_schema, #max_len, #min_len, #special_charecters, #upper_case, #validate_attribute, #validate_schema

Methods included from ClassSpecifier

#array, #boolean, #integer

Constructor Details

#initialize(options) ⇒ WithSchemaValidator



8
9
10
11
12
13
# File 'lib/password_schema_validator/with_schema_validator.rb', line 8

def initialize(options)
  filtered_options = filter_options(options)
  validate_schema(filtered_options)

  super
end

Instance Method Details

#filter_options(options) ⇒ Object



19
20
21
# File 'lib/password_schema_validator/with_schema_validator.rb', line 19

def filter_options(options)
  options.except(:attributes, :class)
end

#validate_each(record, attr_name, value) ⇒ Object



15
16
17
# File 'lib/password_schema_validator/with_schema_validator.rb', line 15

def validate_each(record, attr_name, value)
  match_against_schema(record, attr_name, value)
end