debian-mirror-gitlab/lib/declarative_policy/delegate_dsl.rb

17 lines
388 B
Ruby
Raw Normal View History

2018-05-09 12:01:36 +05:30
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
2018-11-18 11:00:15 +05:30
def method_missing(msg, *args)
return super unless args.empty? && !block_given?
2018-05-09 12:01:36 +05:30
2018-11-18 11:00:15 +05:30
@rule_dsl.delegate(@delegate_name, msg)
2018-05-09 12:01:36 +05:30
end
end
end