Sha256: d540f30fbcd5459017366803fde1bd15f8754ff41fa75db1f93acf706733410f

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require 'cogitate/interfaces'

module Cogitate
  module Models
    class Agent
      # A parameter style class that can be sent to the client of Cogitate.
      #
      # The token, if decoded and parsed will be the given agent. Likewise the agent, if encoded would be the given token.
      class WithToken < SimpleDelegator
        include Contracts
        Contract(KeywordArgs[agent: Cogitate::Interfaces::AgentInterface, token: String] => Any)
        def initialize(agent:, token:)
          self.token = token
          self.agent = agent
          super(agent)
        end

        private

        attr_accessor :agent, :token

        public

        alias_method :to_token, :token
        public :to_token
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cogitate-0.0.2 lib/cogitate/models/agent/with_token.rb