Sha256: a06d9d4688ff03b9cf014986a6ce2429cb51da2d9921042d78c9fd27168f78a3

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

module GraphQL
  module Relay
    # Mostly an internal concern.
    #
    # Wraps an object as a `node`, and exposes a connection-specific `cursor`.
    class Edge < GraphQL::ObjectType
      attr_reader :node, :parent, :connection
      def initialize(node, connection)
        @node = node
        @connection = connection
        @parent = parent
      end

      def cursor
        @cursor ||= connection.cursor_from_node(node)
      end

      def parent
        @parent ||= connection.parent
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-relay-0.11.1 lib/graphql/relay/edge.rb
graphql-relay-0.11.0 lib/graphql/relay/edge.rb