2018-08-03 17:22:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-01-09 20:47:15 +00:00
|
|
|
module Presentable
|
2018-04-05 21:04:42 +00:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
|
|
|
def present(attributes)
|
2020-10-13 00:08:42 +00:00
|
|
|
all.map { |klass_object| klass_object.present(**attributes) }
|
2018-04-05 21:04:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-01-09 20:47:15 +00:00
|
|
|
def present(**attributes)
|
|
|
|
Gitlab::View::Presenter::Factory
|
2020-10-13 00:08:42 +00:00
|
|
|
.new(self, **attributes)
|
2017-01-09 20:47:15 +00:00
|
|
|
.fabricate!
|
|
|
|
end
|
|
|
|
end
|