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