summaryrefslogtreecommitdiff
path: root/lib/gitlab/view/presenter/base.rb
blob: 51e7ab064fe4e45b943790988cceb95d59236ef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Gitlab
  module View
    module Presenter
      module Base
        extend ActiveSupport::Concern

        include Gitlab::Routing
        include Gitlab::Allowable

        attr_reader :subject

        def can?(user, action)
          super(user, action, subject)
        end

        private

        class_methods do
          def presents(name)
            define_method(name) { subject }
          end
        end
      end
    end
  end
end