Sha256: b8a22465c2cac2b84c424268d81d5ab29f5f291941636f54f5be6257c751fabe
Contents?: true
Size: 543 Bytes
Versions: 1
Compression:
Stored size: 543 Bytes
Contents
module GraphQL class Schema class EachItemValidator def initialize(errors) @errors = errors end def validate(items, as:, must_be:) if !items.is_a?(Array) @errors << "#{as} must be an Array, not #{items.inspect}" return else invalid_items = items.select {|k| !yield(k) } if invalid_items.any? @errors << "#{as} must be #{must_be}, but some aren't: #{invalid_items.map(&:to_s).join(", ")}" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.13.0 | lib/graphql/schema/each_item_validator.rb |