Welcome to mirror list, hosted at ThFree Co, Russian Federation.

delegate_dsl.rb « declarative_policy « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f544dffe88874c2597dc11b3b67ee335325b3e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module DeclarativePolicy
  # Used when the name of a delegate is mentioned in
  # the rule DSL.
  class DelegateDsl
    def initialize(rule_dsl, delegate_name)
      @rule_dsl = rule_dsl
      @delegate_name = delegate_name
    end

    def method_missing(m, *a, &b)
      return super unless a.empty? && !block_given?

      @rule_dsl.delegate(@delegate_name, m)
    end
  end
end