Class: McpAuthorization::Cache::Signature

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#argObject

Returns the value of attribute arg

Returns:

  • (Object)

    the current value of arg



9
10
11
# File 'lib/mcp_authorization/cache/recorder.rb', line 9

def arg
  @arg
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



9
10
11
# File 'lib/mcp_authorization/cache/recorder.rb', line 9

def method
  @method
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



9
10
11
# File 'lib/mcp_authorization/cache/recorder.rb', line 9

def target
  @target
end

Instance Method Details

#canonicalObject

: () -> 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

Returns:

  • (Boolean)


16
17
18
# File 'lib/mcp_authorization/cache/recorder.rb', line 16

def eql?(other)
  other.is_a?(Signature) && canonical == other.canonical
end

#hashObject

: () -> Integer



21
22
23
# File 'lib/mcp_authorization/cache/recorder.rb', line 21

def hash
  canonical.hash
end