class ArSerializer::GraphQL::SerializableTypeClass

Public Instance Methods

==(t) click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 339
def == t
  eql? t
end
association_type() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 323
def association_type
  self
end
collect_types(types) click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 317
def collect_types(types)
  return if types[self]
  types[self] = true
  fields.each { |field| field.collect_types types }
end
compare_elements() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 343
def compare_elements
  [type, field_only, field_except]
end
eql?(t) click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 335
def eql?(t)
  self.class == t.class && self.compare_elements == t.compare_elements
end
field_except() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 288
def field_except
  [*except].map(&:to_s)
end
field_only() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 284
def field_only
  [*only].map(&:to_s)
end
fields() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 309
def fields
  keys = type._serializer_field_keys - ['__schema'] - field_except
  keys = field_only & keys unless field_only.empty?
  keys.map do |name|
    FieldClass.new name, type._serializer_field_info(name)
  end
end
gql_type() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 327
def gql_type
  name
end
hash() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 347
def hash
  compare_elements.hash
end
kind() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 292
def kind
  'OBJECT'
end
name() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 296
def name
  name_segments = [type.name.delete(':')]
  unless field_only.empty?
    name_segments << 'Only'
    name_segments << field_only.map(&:camelize)
  end
  unless field_except.empty?
    name_segments << 'Except'
    name_segments << field_except.map(&:camelize)
  end
  name_segments.join
end
ts_type() click to toggle source
# File lib/ar_serializer/graphql/types.rb, line 331
def ts_type
  "Type#{name}"
end