class GraphQL::Relay::GlobalIdResolve

Public Class Methods

new(type:) click to toggle source
# File lib/graphql/relay/global_id_resolve.rb, line 4
def initialize(type))
  @type = type
end

Public Instance Methods

call(obj, args, ctx) click to toggle source
# File lib/graphql/relay/global_id_resolve.rb, line 8
def call(obj, args, ctx)
  if obj.is_a?(GraphQL::Schema::Object)
    obj = obj.object
  end
  type = @type.respond_to?(:graphql_definition) ? @type.graphql_definition : @type
  ctx.query.schema.id_from_object(obj, type, ctx)
end