Class: ArSerializer::GraphQL::OrTypeClass
Instance Attribute Summary
Attributes inherited from TypeClass
#except, #only, #type
Instance Method Summary
collapse
Methods inherited from TypeClass
#association_type, #description, #fields, from, #initialize, #of_type, #validate!
Instance Method Details
#collect_types(types) ⇒ Object
401
402
403
404
|
# File 'lib/ar_serializer/graphql/types.rb', line 401
def collect_types(types)
types[:other] = true
of_types.map { |t| t.collect_types types }
end
|
#gql_type ⇒ Object
406
407
408
|
# File 'lib/ar_serializer/graphql/types.rb', line 406
def gql_type
kind
end
|
#kind ⇒ Object
389
390
391
|
# File 'lib/ar_serializer/graphql/types.rb', line 389
def kind
'OBJECT'
end
|
#name ⇒ Object
393
394
395
|
# File 'lib/ar_serializer/graphql/types.rb', line 393
def name
:other
end
|
#of_types ⇒ Object
397
398
399
|
# File 'lib/ar_serializer/graphql/types.rb', line 397
def of_types
type.map { |t| TypeClass.from t, only, except }
end
|
#sample ⇒ Object
410
411
412
|
# File 'lib/ar_serializer/graphql/types.rb', line 410
def sample
of_types.first.sample
end
|
#ts_type ⇒ Object
414
415
416
|
# File 'lib/ar_serializer/graphql/types.rb', line 414
def ts_type
'(' + of_types.map(&:ts_type).join(' | ') + ')'
end
|