blob: c05a7609fec50c1c723e03f983e3cbe45b752163 (
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
|
# frozen_string_literal: true
# This module memoizes some attributes to reduce memory allocations.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/420623
# See https://gitlab.com/gitlab-org/ruby/gems/declarative-policy/-/merge_requests/52
module DeclarativePolicyCachedAttributes
def ability_map
@ability_map ||= super
end
def conditions
@conditions ||= super
end
def global_actions
@global_actions ||= super
end
def delegations
@delegations ||= super
end
end
DeclarativePolicy::Base.singleton_class.prepend(DeclarativePolicyCachedAttributes)
|