Sha256: 835b958f58d9e8595150cad370b33a83d760795c6e762b025a5c53287d61c267
Contents?: true
Size: 862 Bytes
Versions: 1
Compression:
Stored size: 862 Bytes
Contents
require 'lotus/utils/kernel' module Lotus module Validations # Coercions for attribute's values. # # @since 0.1.0 # @api private module Coercions # Coerces the given values with the given type # # @param coercer [Class] the type # @param values [Array] of objects to be coerced # @param blk [Proc] an optional block to pass to the custom coercer # # @raise [TypeError] if the coercion fails # @raise [ArgumentError] if the custom coercer's `#initialize` has a wrong arity. # # @since 0.1.0 # @api private def self.coerce(coercer, *values, &blk) if ::Lotus::Utils::Kernel.respond_to?(coercer.to_s) ::Lotus::Utils::Kernel.__send__(coercer.to_s, *values, &blk) else coercer.new(*values, &blk) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lotus-validations-0.1.0 | lib/lotus/validations/coercions.rb |