Class: GraphQL::AbstractField
- Inherits:
-
Object
- Object
- GraphQL::AbstractField
- Defined in:
- lib/graph_ql/fields/abstract_field.rb
Overview
Anything can be a Field as long as it responds to:
- #name: String the name to access this field in a query
- #type: Type returned by this field's resolve function
- #description: String
- #resolve(object, arguments, context): Object of Type `type`
- #arguments: ???
- #deprecation_reason
Direct Known Subclasses
Instance Method Summary collapse
- #arguments ⇒ Object
- #deprecated? ⇒ Boolean
- #deprecation_reason ⇒ Object
- #description ⇒ Object
- #name ⇒ Object
- #resolve(object, arguments, context) ⇒ Object
- #type ⇒ Object
Instance Method Details
#arguments ⇒ Object
26 27 28 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 26 def arguments {} end |
#deprecated? ⇒ Boolean
30 31 32 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 30 def deprecated? !!deprecation_reason end |
#deprecation_reason ⇒ Object
34 35 36 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 34 def deprecation_reason nil end |
#description ⇒ Object
17 18 19 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 17 def description raise NotImplementedError, "#{self.class.name}#description should return this field's description" end |
#name ⇒ Object
9 10 11 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 9 def name raise NotImplementedError, "#{self.class.name}#name should return the name for accessing this field" end |
#resolve(object, arguments, context) ⇒ Object
22 23 24 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 22 def resolve(object, arguments, context) raise NotImplementedError, "#{self.class.name}#resolve(object, arguments, context) should execute this field for object" end |
#type ⇒ Object
13 14 15 |
# File 'lib/graph_ql/fields/abstract_field.rb', line 13 def type raise NotImplementedError, "#{self.class.name}#type should return the type class which this field returns" end |