class GraphQL::Client::Schema::ObjectType::WithDefinition

Constants

EMPTY_SET

Attributes

defined_fields[R]
definition[R]
klass[R]

Public Class Methods

new(klass, defined_fields, definition, spreads) click to toggle source
# File lib/graphql/client/schema/object_type.rb, line 49
def initialize(klass, defined_fields, definition, spreads)
  @klass = klass
  @defined_fields = defined_fields.map do |k, v|
    [-k.to_s, v]
  end.to_h
  @definition = definition
  @spreads = spreads unless spreads.empty?

  @defined_fields.keys.each do |attr|
    name = ActiveSupport::Inflector.underscore(attr)
    @klass::READERS[:"#{name}"] ||= attr
    @klass::PREDICATES[:"#{name}?"] ||= attr
  end
end

Public Instance Methods

fields() click to toggle source
# File lib/graphql/client/schema/object_type.rb, line 37
def fields
  @klass.fields
end
new(data = {}, errors = Errors.new) click to toggle source
# File lib/graphql/client/schema/object_type.rb, line 64
def new(data = {}, errors = Errors.new)
  @klass.new(data, errors, self)
end
spreads() click to toggle source
# File lib/graphql/client/schema/object_type.rb, line 41
def spreads
  if defined?(@spreads)
    @spreads
  else
    EMPTY_SET
  end
end
type() click to toggle source
# File lib/graphql/client/schema/object_type.rb, line 33
def type
  @klass.type
end