2018-11-09 18:39:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-21 07:52:24 +00:00
|
|
|
module Gitlab
|
|
|
|
module Graphql
|
2018-05-23 07:55:14 +00:00
|
|
|
module Present
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
prepended do
|
|
|
|
def self.present_using(kls)
|
|
|
|
@presenter_class = kls
|
2018-05-21 07:52:24 +00:00
|
|
|
end
|
|
|
|
|
2018-05-23 07:55:14 +00:00
|
|
|
def self.presenter_class
|
|
|
|
@presenter_class
|
2018-05-21 07:52:24 +00:00
|
|
|
end
|
|
|
|
end
|
2018-05-23 07:55:14 +00:00
|
|
|
|
|
|
|
def self.use(schema_definition)
|
2020-03-26 06:08:40 +00:00
|
|
|
schema_definition.instrument(:field, ::Gitlab::Graphql::Present::Instrumentation.new)
|
2018-05-23 07:55:14 +00:00
|
|
|
end
|
2018-05-21 07:52:24 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|