Sha256: 90bc1d247e8b5fe5cac7f5d990fca60211c1a4f3b9a64397ef1e15d534a61f98

Contents?: true

Size: 327 Bytes

Versions: 5

Compression:

Stored size: 327 Bytes

Contents

class GraphQL::Schema::EachItemValidator
  def initialize(errors)
    @errors = errors
  end

  def validate(items, as:, must_be:)
    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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
graphql-0.6.0 lib/graphql/schema/each_item_validator.rb
graphql-0.5.0 lib/graph_ql/schema/each_item_validator.rb
graphql-0.4.0 lib/graph_ql/schema/each_item_validator.rb
graphql-0.3.0 lib/graph_ql/schema/each_item_validator.rb
graphql-0.2.0 lib/graph_ql/schema/each_item_validator.rb