debian-mirror-gitlab/app/models/concerns/presentable.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
337 B
Ruby
Raw Permalink Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Presentable
2018-05-09 12:01:36 +05:30
extend ActiveSupport::Concern
class_methods do
def present(attributes)
2021-01-03 14:25:43 +05:30
all.map { |klass_object| klass_object.present(**attributes) }
2018-05-09 12:01:36 +05:30
end
end
2017-08-17 22:00:37 +05:30
def present(**attributes)
Gitlab::View::Presenter::Factory
2021-01-03 14:25:43 +05:30
.new(self, **attributes)
2017-08-17 22:00:37 +05:30
.fabricate!
end
end