Sha256: 740ef326c47678bf80f2a383f0d6ac82e161a18eab1fdbb518634264c08b860c

Contents?: true

Size: 1.45 KB

Versions: 48

Compression:

Stored size: 1.45 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)
        GraphQL::Deprecation.warn "GraphQL::Relay::Node.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodeField instead"
        # 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)
        GraphQL::Deprecation.warn "GraphQL::Relay::Nodes.field will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::NodesField instead"
        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
        GraphQL::Deprecation.warn "GraphQL::Relay::Node.interface will be removed from GraphQL-Ruby 2.0, use GraphQL::Types::Relay::Node instead"
        @interface ||= GraphQL::Types::Relay::Node.graphql_definition
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
graphql-1.13.23 lib/graphql/relay/node.rb
graphql-1.13.22 lib/graphql/relay/node.rb
graphql-1.13.21 lib/graphql/relay/node.rb
graphql-1.13.20 lib/graphql/relay/node.rb
graphql-1.13.19 lib/graphql/relay/node.rb
graphql-1.13.18 lib/graphql/relay/node.rb
graphql-1.13.17 lib/graphql/relay/node.rb
graphql-1.13.16 lib/graphql/relay/node.rb
graphql-1.13.15 lib/graphql/relay/node.rb
graphql-1.13.14 lib/graphql/relay/node.rb
graphql-1.13.13 lib/graphql/relay/node.rb
graphql_cody-1.13.0 lib/graphql/relay/node.rb
graphql-1.13.12 lib/graphql/relay/node.rb
graphql-1.13.11 lib/graphql/relay/node.rb
graphql-1.13.10 lib/graphql/relay/node.rb
graphql-1.13.9 lib/graphql/relay/node.rb
graphql-1.12.24 lib/graphql/relay/node.rb
graphql-1.13.8 lib/graphql/relay/node.rb
graphql-1.13.7 lib/graphql/relay/node.rb
graphql-1.13.6 lib/graphql/relay/node.rb