Class: GraphQL::UnionType
- Inherits:
-
Object
- Object
- GraphQL::UnionType
- Includes:
- DefinitionHelpers::NonNullWithBang
- Defined in:
- lib/graph_ql/union_type.rb
Overview
A collection of ObjectTypes
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#possible_types ⇒ Object
readonly
Returns the value of attribute possible_types.
Instance Method Summary collapse
-
#initialize(name, desc, types) ⇒ UnionType
constructor
A new instance of UnionType.
- #kind ⇒ Object
- #resolve_type(object) ⇒ Object
Methods included from DefinitionHelpers::NonNullWithBang
Constructor Details
#initialize(name, desc, types) ⇒ UnionType
Returns a new instance of UnionType.
9 10 11 12 13 |
# File 'lib/graph_ql/union_type.rb', line 9 def initialize(name, desc, types) @name = name @description = desc @possible_types = types end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/graph_ql/union_type.rb', line 8 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/graph_ql/union_type.rb', line 8 def name @name end |
#possible_types ⇒ Object (readonly)
Returns the value of attribute possible_types.
8 9 10 |
# File 'lib/graph_ql/union_type.rb', line 8 def possible_types @possible_types end |
Instance Method Details
#kind ⇒ Object
15 16 17 |
# File 'lib/graph_ql/union_type.rb', line 15 def kind GraphQL::TypeKinds::UNION end |
#resolve_type(object) ⇒ Object
20 21 22 23 |
# File 'lib/graph_ql/union_type.rb', line 20 def resolve_type(object) type_name = object.class.name possible_types.find {|t| t.name == type_name} end |