Sha256: bc5004760c40b57ee09f4c6f382c5545cb4110184e7e69b52dad642d28d8cf58

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module RHCP
  
  # The context class is used for transporting both the context hash and some
  # other client state like the parameter values that have been collected during
  # user input. It should be sent with all rhcp remote calls and should generally
  # be treated as optional.
  class Context
    
    # hash holding context information; similar to HTTP cookies
    # TODO should we actually use cookies for transporting this info?
    attr_accessor :cookies
    
    def initialize(cookies = {})
      @cookies = cookies
    end       
    
    # def to_json(*args)
      # {
        # 'cookies' => @cookies,
      # }.to_json(*args)
    # end  
#     
    # def self.reconstruct_from_json(json_data)
      # $logger.debug "reconstructing context from json : >>#{json_data}<<"
      # object = JSON.parse(json_data)
      # instance = self.new()
      # instance.cookies = object['cookies'] 
#       
      # instance
    # end

    def to_s
      result = "<Context with #{@cookies.size} cookies>"
      # @cookies.each do |k,v|
        # result += " '#{k}'='#{v}'"
      # end
      # result += ">"
      result
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhcp-0.2.17 lib/rhcp/context.rb
rhcp-0.2.16 lib/rhcp/context.rb