Sha256: 9ab6ea9b926348e6d4a82db7d3b7037c8eda783bdc8dd91adc006c66c79699a8

Contents?: true

Size: 523 Bytes

Versions: 7

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Types
    module Relay
      module NodeBehaviors
        def self.included(child_module)
          child_module.extend(DefaultRelay)
          child_module.description("An object with an ID.")
          child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id)
        end

        def default_global_id
          context.schema.id_from_object(object, self.class, context)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-2.0.17.2 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.17.1 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.19 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.18 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.17 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.16 lib/graphql/types/relay/node_behaviors.rb
graphql-2.0.15 lib/graphql/types/relay/node_behaviors.rb