Class: GraphQL::Dataloader::RequestAll
- Defined in:
- lib/graphql/dataloader/request_all.rb
Overview
Instance Method Summary collapse
-
#initialize(source, keys) ⇒ RequestAll
constructor
A new instance of RequestAll.
-
#load ⇒ Array<Object>
Call this method to cause the current Fiber to wait for the results of this request.
Constructor Details
#initialize(source, keys) ⇒ RequestAll
Returns a new instance of RequestAll.
6 7 8 9 |
# File 'lib/graphql/dataloader/request_all.rb', line 6 def initialize(source, keys) @source = source @keys = keys end |
Instance Method Details
#load ⇒ Array<Object>
Call this method to cause the current Fiber to wait for the results of this request.
14 15 16 17 18 19 |
# File 'lib/graphql/dataloader/request_all.rb', line 14 def load if @keys.any? { |k| !@source.results.key?(k) } @source.sync end @keys.map { |k| @source.results[k] } end |