Class: Interdependence::Types::ValidatorClassCoercer
- Inherits:
-
Object
- Object
- Interdependence::Types::ValidatorClassCoercer
- Defined in:
- lib/interdependence/types.rb
Overview
Coerce and validate that an argument is an ActiveModel::Validator
Class Method Summary collapse
-
.call(value) ⇒ value passed in
private
returns value given so that success can test it.
-
.success?(primitive, value) ⇒ TrueClass, FalseClass
private
Determine whether a validator class is valid.
Class Method Details
.call(value) ⇒ value passed in
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.
returns value given so that success can test it
181 182 183 |
# File 'lib/interdependence/types.rb', line 181 def self.call(value) value end |
.success?(primitive, value) ⇒ TrueClass, FalseClass
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.
Determine whether a validator class is valid
194 195 196 |
# File 'lib/interdependence/types.rb', line 194 def self.success?(primitive, value) value.instance_of?(primitive) && value.ancestors.include?(::ActiveModel::Validator) end |