lib/checkpoint/agent/token.rb in checkpoint-1.0.3 vs lib/checkpoint/agent/token.rb in checkpoint-1.1.0
- old
+ new
@@ -1,13 +1,13 @@
# frozen_string_literal: true
module Checkpoint
class Agent
# An Agent::Token is an identifier object for an Agent. It
- # includes a type and an identifier. A {Permit} can be granted for a Token.
+ # includes a type and an identifier. A {Grant} can be created for a Token.
# Concrete actors are resolved into a number of agents, and those agents'
- # tokens will be checked for matching permits.
+ # tokens will be checked for matching grants.
class Token
attr_reader :type, :id
# Create a new Agent Token representing an actor in an application.
#
@@ -32,18 +32,23 @@
# @return [Token] self; for convenience of taking an Agent or token
def token
self
end
- # @return [String] a token string suitable for granting or matching permits for this agent
+ # @return [String] a token string suitable for granting or matching grants for this agent
def to_s
"#{type}:#{id}"
end
# Compare with another Agent for equality. Consider them to represent
# the same resource if `other` is an Agent, has the same type, and same id.
def eql?(other)
other.is_a?(Token) && type == other.type && id == other.id
+ end
+
+ # @return [Integer] hash code based on to_s
+ def hash
+ to_s.hash
end
alias == eql?
alias inspect uri
end