Sha256: 92fec09899cfdc5beaf25629e047a4b0d6385063f660b19bd1b1427f415956ea

Contents?: true

Size: 347 Bytes

Versions: 3

Compression:

Stored size: 347 Bytes

Contents

module Virtus
  class Attribute

    module Strict

      # @api public
      def coerce(*)
        output = super

        if coercer.success?(primitive, output) || !required? && output.nil?
          output
        else
          raise CoercionError.new(output, primitive)
        end
      end

    end # Strict

  end # Attribute
end # Virtus

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
virtus-1.0.0.rc1 lib/virtus/attribute/strict.rb
virtus-1.0.0.beta8 lib/virtus/attribute/strict.rb
virtus-1.0.0.beta7 lib/virtus/attribute/strict.rb