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