Class: McpAuthorization::Cache::RecorderUser
- Inherits:
-
Object
- Object
- McpAuthorization::Cache::RecorderUser
show all
- Defined in:
- lib/mcp_authorization/cache/recorder.rb
Overview
Records can? and default_for on the wrapped user. default_for
returns a value baked into the schema, so its result is part of the
decision vector too, not just predicate booleans.
Instance Method Summary
collapse
Constructor Details
#initialize(target, consulted) ⇒ RecorderUser
Returns a new instance of RecorderUser.
82
83
84
85
|
# File 'lib/mcp_authorization/cache/recorder.rb', line 82
def initialize(target, consulted)
@__target = target
@consulted = consulted
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
105
106
107
|
# File 'lib/mcp_authorization/cache/recorder.rb', line 105
def method_missing(name, *args, &block)
@__target.public_send(name, *args, &block)
end
|
Instance Method Details
#can?(flag) ⇒ Boolean
88
89
90
91
|
# File 'lib/mcp_authorization/cache/recorder.rb', line 88
def can?(flag)
@consulted << Signature.new(:user, "can?", flag)
@__target.can?(flag)
end
|
#default_for(key) ⇒ Object
94
95
96
97
|
# File 'lib/mcp_authorization/cache/recorder.rb', line 94
def default_for(key)
@consulted << Signature.new(:user, "default_for", key)
@__target.default_for(key)
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
100
101
102
|
# File 'lib/mcp_authorization/cache/recorder.rb', line 100
def respond_to_missing?(name, include_private = false)
@__target.respond_to?(name, include_private)
end
|