Module: Gitlab::Graphql::Present

Extended by:
ActiveSupport::Concern
Included in:
Types::BaseObject
Defined in:
lib/gitlab/graphql/present.rb,
lib/gitlab/graphql/present/field_extension.rb

Defined Under Namespace

Classes: FieldExtension

Instance Method Summary collapse

Instance Method Details

#present(object_type, attrs) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/gitlab/graphql/present.rb', line 28

def present(object_type, attrs)
  return unless object_type.respond_to?(:present)

  self.unwrapped ||= object
  # @object belongs to Schema::Object, which does not expose a writer.
  @object = object_type.present(unwrapped, attrs) # rubocop: disable Gitlab/ModuleWithInstanceVariables
end

#unpresentedObject



24
25
26
# File 'lib/gitlab/graphql/present.rb', line 24

def unpresented
  unwrapped || object
end