Class: McpAuthorization::Cache::Signature
- Inherits:
-
Struct
- Object
- Struct
- McpAuthorization::Cache::Signature
- Defined in:
- lib/mcp_authorization/cache/recorder.rb
Overview
A signature for one decision the compiler consulted on the server context: a predicate call (‘feature?(:sms)`, `requires?(:admin)`, a custom `tier?(:enterprise)`), or a `current_user.can?` / `default_for` call. Identity is by (target, method, arg) so the same decision dedupes across tools; arg is retained intact so replay calls the predicate with the original value, not a coerced one.
Instance Attribute Summary collapse
-
#arg ⇒ Object
Returns the value of attribute arg.
-
#method ⇒ Object
Returns the value of attribute method.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#canonical ⇒ Object
: () -> String.
-
#eql?(other) ⇒ Boolean
: (untyped) -> bool.
-
#hash ⇒ Object
: () -> Integer.
Instance Attribute Details
#arg ⇒ Object
Returns the value of attribute arg
9 10 11 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 9 def arg @arg end |
#method ⇒ Object
Returns the value of attribute method
9 10 11 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 9 def method @method end |
#target ⇒ Object
Returns the value of attribute target
9 10 11 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 9 def target @target end |
Instance Method Details
#canonical ⇒ Object
: () -> String
11 12 13 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 11 def canonical "#{target}\x1f#{method}\x1f#{arg.inspect}" end |
#eql?(other) ⇒ Boolean
: (untyped) -> bool
16 17 18 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 16 def eql?(other) other.is_a?(Signature) && canonical == other.canonical end |
#hash ⇒ Object
: () -> Integer
21 22 23 |
# File 'lib/mcp_authorization/cache/recorder.rb', line 21 def hash canonical.hash end |