class GraphQL::Relay::Walker::Frame
Attributes
context[R]
gid[R]
parent[R]
queue[R]
result[RW]
Public Class Methods
new(queue, gid, parent)
click to toggle source
Initialize a new Frame
.
queue - The Queue
that this frame belongs to. gid - The String GID. parent - The Frame
where this GID was discovered.
Returns nothing.
# File lib/graphql/relay/walker/frame.rb, line 13 def initialize(queue, gid, parent) @queue = queue @gid = gid @parent = parent @context = {} end
Public Instance Methods
child(gid)
click to toggle source
Make a new frame with the given GID and this frame as its parent.
gid - The String GID to create the frame with.
Returns a Frame
instance.
# File lib/graphql/relay/walker/frame.rb, line 32 def child(gid) Frame.new(queue, gid, self) end
enqueue_found_gids()
click to toggle source
Add each found GID to the queue.
Returns nothing.
# File lib/graphql/relay/walker/frame.rb, line 23 def enqueue_found_gids found_gids.each { |gid| queue.add(child(gid)) } end
found_gids(data = result)
click to toggle source
The GIDs from this frame's results.
Returns an Array of GID Strings.
# File lib/graphql/relay/walker/frame.rb, line 39 def found_gids(data = result) [].tap do |ids| case data when Hash ids.concat(Array(data['id'])) ids.concat(found_gids(data.values)) when Array data.each { |datum| ids.concat(found_gids(datum)) } end end end