Class: GraphQL::Relay::GlobalIdResolve
- Inherits:
- 
      Object
      
        - Object
- GraphQL::Relay::GlobalIdResolve
 
- Defined in:
- lib/graphql/relay/global_id_resolve.rb
Instance Method Summary collapse
- 
  
    
      #call(obj, args, ctx)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
- 
  
    
      #initialize(type:)  ⇒ GlobalIdResolve 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of GlobalIdResolve. 
Constructor Details
#initialize(type:) ⇒ GlobalIdResolve
Returns a new instance of GlobalIdResolve.
| 5 6 7 | # File 'lib/graphql/relay/global_id_resolve.rb', line 5 def initialize(type:) @type = type end | 
Instance Method Details
#call(obj, args, ctx) ⇒ Object
| 9 10 11 12 13 14 15 | # File 'lib/graphql/relay/global_id_resolve.rb', line 9 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(silence_deprecation_warning: true) : @type ctx.query.schema.id_from_object(obj, type, ctx) end |