Module: ActiveModel::Validator::Interdependence::ClassMethods

Includes:
CherryPickedClassMethods, Interdependence::ActiveModel::ClassMethods
Defined in:
lib/activemodel/validator/interdependence.rb

Overview

Methods to extend ActiveModel::Validator

Constant Summary

Constants included from CherryPickedClassMethods

ActiveModel::Validator::Interdependence::CherryPickedClassMethods::CHERRY_PICK_METHODS

Instance Method Summary collapse

Methods included from Interdependence::ActiveModel::ClassMethods

#validate, #validates_with

Instance Method Details

#inherited(base) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Handle an ActiveModel validator inheritance

Returns:

  • (undefined)

45
46
47
48
49
# File 'lib/activemodel/validator/interdependence.rb', line 45

def inherited(base)
  super
  return if base == EachValidator
  base.include(::Interdependence::Validator)
end

#validates(*args, &blk) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Rewrite validator kinds before ActiveModel receives it

Since we pluck the methods from ActiveModel, the inflection done in the method (`“#ActiveModel::Validator::Interdependence::ClassMethods.keykey.to_skey.to_s.camelizeValidator”`) does not resolve like it would in the `ActiveModel` namespace.

Returns:

  • (undefined)

See Also:


63
64
65
66
67
68
69
70
71
72
# File 'lib/activemodel/validator/interdependence.rb', line 63

def validates(*args, &blk)
  options = args.extract_options!
  new_options = options.each.with_object({}) do |(key, value), memo|
    key = ensure_namespace(key) if key.is_a?(String) || key.is_a?(Symbol)

    memo[key] = value
  end

  super(*args, new_options, &blk)
end