2018-03-08 07:56:54 -05:00
|
|
|
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-07-04 10:02:01 -04:00
|
|
|
def method_missing(msg, *args)
|
|
|
|
return super unless args.empty? && !block_given?
|
2018-03-08 07:56:54 -05:00
|
|
|
|
2018-07-04 10:02:01 -04:00
|
|
|
@rule_dsl.delegate(@delegate_name, msg)
|
2018-03-08 07:56:54 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|