Class: DeclarativePolicy::DelegateDsl
- Inherits:
-
Object
- Object
- DeclarativePolicy::DelegateDsl
- Defined in:
- lib/declarative_policy/delegate_dsl.rb
Overview
Used when the name of a delegate is mentioned in the rule DSL.
Instance Method Summary collapse
-
#initialize(rule_dsl, delegate_name) ⇒ DelegateDsl
constructor
A new instance of DelegateDsl.
- #method_missing(msg, *args) ⇒ Object
- #respond_to_missing?(msg, include_all) ⇒ Boolean
Constructor Details
#initialize(rule_dsl, delegate_name) ⇒ DelegateDsl
Returns a new instance of DelegateDsl.
7 8 9 10 |
# File 'lib/declarative_policy/delegate_dsl.rb', line 7 def initialize(rule_dsl, delegate_name) @rule_dsl = rule_dsl @delegate_name = delegate_name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args) ⇒ Object
12 13 14 15 16 |
# File 'lib/declarative_policy/delegate_dsl.rb', line 12 def method_missing(msg, *args) return super unless args.empty? && !block_given? @rule_dsl.delegate(@delegate_name, msg) end |
Instance Method Details
#respond_to_missing?(msg, include_all) ⇒ Boolean
18 19 20 |
# File 'lib/declarative_policy/delegate_dsl.rb', line 18 def respond_to_missing?(msg, include_all) true end |