Sha256: 2b84a5c21200a2dcb8e12a305e9c5952415b6b5d3cd91a344928fc76fa3c5935

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true
module GraphQL
  module Relay
    # Helpers for working with Relay-specific Node objects.
    module Node
      # @return [GraphQL::Field] a field for finding objects by their global ID.
      def self.field(**kwargs, &block)
        # We have to define it fresh each time because
        # its name will be modified and its description
        # _may_ be modified.
        field = GraphQL::Types::Relay::NodeField.graphql_definition

        if kwargs.any? || block
          field = field.redefine(kwargs, &block)
        end

        field
      end

      def self.plural_field(**kwargs, &block)
        field = GraphQL::Types::Relay::NodesField.graphql_definition

        if kwargs.any? || block
          field = field.redefine(kwargs, &block)
        end

        field
      end

      # @return [GraphQL::InterfaceType] The interface which all Relay types must implement
      def self.interface
        @interface ||= GraphQL::Types::Relay::Node.graphql_definition
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
graphql-1.10.0.pre3 lib/graphql/relay/node.rb
graphql-1.9.17 lib/graphql/relay/node.rb
graphql-1.10.0.pre2 lib/graphql/relay/node.rb
graphql-1.9.16 lib/graphql/relay/node.rb
graphql-1.9.15 lib/graphql/relay/node.rb
graphql-1.9.14 lib/graphql/relay/node.rb
graphql-1.10.0.pre1 lib/graphql/relay/node.rb
graphql-1.9.13 lib/graphql/relay/node.rb
graphql-1.9.12 lib/graphql/relay/node.rb
graphql-1.9.11 lib/graphql/relay/node.rb
graphql-1.9.10 lib/graphql/relay/node.rb
graphql-1.9.9 lib/graphql/relay/node.rb
graphql-1.9.8 lib/graphql/relay/node.rb
graphql-1.9.7 lib/graphql/relay/node.rb
graphql-1.9.6 lib/graphql/relay/node.rb
graphql-1.9.5 lib/graphql/relay/node.rb
graphql-1.9.4 lib/graphql/relay/node.rb
graphql-1.9.3 lib/graphql/relay/node.rb
graphql-1.9.2 lib/graphql/relay/node.rb
graphql-1.9.1 lib/graphql/relay/node.rb