Class: GraphQL::Relay::GlobalIdField
- Inherits:
-
Field
- Object
- Field
- GraphQL::Relay::GlobalIdField
- Defined in:
- lib/graphql/relay/global_id_field.rb
Overview
Instance Method Summary collapse
-
#initialize(type_name, property: :id) ⇒ GlobalIdField
constructor
A new instance of GlobalIdField.
Constructor Details
#initialize(type_name, property: :id) ⇒ GlobalIdField
Returns a new instance of GlobalIdField.
9 10 11 12 13 14 15 |
# File 'lib/graphql/relay/global_id_field.rb', line 9 def initialize(type_name, property: :id) self.arguments = {} self.type = !GraphQL::ID_TYPE self.resolve = -> (obj, args, ctx) { ctx.query.schema.node_identification.to_global_id(type_name, obj.public_send(property)) } end |