Module: Lotus::Validations::Coercions Private
- Defined in:
- lib/lotus/validations/coercions.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Coercions for attribute’s values.
Class Method Summary collapse
-
.coerce(coercer, value, &blk) ⇒ Object?
private
Coerces the given values with the given type.
Class Method Details
.coerce(coercer, value, &blk) ⇒ Object?
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.
Coerces the given values with the given type
@param coercer [Class] the type
22 23 24 25 26 27 28 |
# File 'lib/lotus/validations/coercions.rb', line 22 def self.coerce(coercer, value, &blk) if ::Lotus::Utils::Kernel.respond_to?(coercer.to_s) ::Lotus::Utils::Kernel.__send__(coercer.to_s, value, &blk) rescue nil else coercer.new(value, &blk) end end |