Module: ActiveModel::Validator::Interdependence::ClassMethods
- Included in:
- ActiveModel::Validator
- 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
-
#inherited(base) ⇒ undefined
private
Handle an ActiveModel validator inheritance.
-
#validates(*args, &blk) ⇒ undefined
private
Rewrite validator kinds before ActiveModel receives it.
Methods included from Interdependence::ActiveModel::ClassMethods
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
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.
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/activemodel/validator/interdependence.rb', line 63 def validates(*args, &blk) = args. = .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, , &blk) end |