class ArSerializer::GraphQL::HashTypeClass
Public Instance Methods
association_type()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 256 def association_type type.values.each do |v| t = TypeClass.from(v, only, except).association_type return t if t end nil end
collect_types(types)
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 249 def collect_types(types) types[:other] = true type.values.map do |v| TypeClass.from(v, only, except).collect_types(types) end end
gql_type()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 264 def gql_type 'OBJECT' end
kind()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 241 def kind 'SCALAR' end
name()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 245 def name :other end
sample()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 268 def sample type.reject { |k| k.to_s.ends_with? '?' }.transform_values do |v| TypeClass.from(v).sample end end
ts_type()
click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 274 def ts_type fields = type.map do |key, value| k = key.to_s == '*' ? '[key: string]' : key "#{k}: #{TypeClass.from(value, only, except).ts_type}" end "{ #{fields.join('; ')} }" end