README.md in graphql-batch-0.2.4 vs README.md in graphql-batch-0.2.5
- old
+ new
@@ -1,7 +1,10 @@
# GraphQL::Batch
+[![Build Status](https://travis-ci.org/Shopify/graphql-batch.svg?branch=master)](https://travis-ci.org/Shopify/graphql-batch)
+[![Gem Version](https://badge.fury.io/rb/graphql-batch.svg)](https://rubygems.org/gems/graphql-batch)
+
Provides an executor for the [`graphql` gem](https://github.com/rmosolgo/graphql-ruby) which allows queries to be batched.
## Installation
Add this line to your application's Gemfile:
@@ -26,11 +29,11 @@
```ruby
require 'graphql/batch'
```
-Define a custom loader, which is initialized with arguments that are used for grouping and an perform method for performing the batch load.
+Define a custom loader, which is initialized with arguments that are used for grouping and a perform method for performing the batch load.
```ruby
class RecordLoader < GraphQL::Batch::Loader
def initialize(model)
@model = model
@@ -116,10 +119,10 @@
end
```
Use GraphQL::Batch::Promise.all instead of Promise.all to be able to call sync on the returned promise.
-```
+```ruby
def test_batch_query
products = [products(:snowboard), products(:jacket)]
query1 = RecordLoader.for(Product).load(products(:snowboard).id).then(&:title)
query2 = RecordLoader.for(Product).load(products(:jacket).id).then(&:title)
results = GraphQL::Batch::Promise.all([query1, query2]).sync