Sha256: e4eb30bec271dc0964474094c298f0f350ff17e739038bb712b8a49a951c36e4

Contents?: true

Size: 563 Bytes

Versions: 22

Compression:

Stored size: 563 Bytes

Contents

require 'virtus/attribute/collection'

# See https://github.com/solnic/virtus/pull/343
# This monkey-patch fixes type validation for collections,
# ensuring that type assertions are applied to collection
# members.
#
# This patch duplicates the code in the above pull request.
# Once the request, or equivalent functionality, has been
# published into the +virtus+ gem this file should be deleted.
Virtus::Attribute::Collection.class_eval do
  # @api public
  def value_coerced?(value)
    super && value.all? { |item| member_type.value_coerced? item }
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/validations/types/virtus_collection_patch.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.5 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.4 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.3 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.2 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.1 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.2.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.1.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.0.3 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.0.2 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.0.1 lib/grape/validations/types/virtus_collection_patch.rb
grape-1.0.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.19.2 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.19.1 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.19.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.18.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.17.0 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.16.2 lib/grape/validations/types/virtus_collection_patch.rb
grape-0.16.1 lib/grape/validations/types/virtus_collection_patch.rb