Sha256: 8ea22d17c36bdb8ea8505efc8ed05fb157e17872c880b2afc28a0c8e33e5ed61
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 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 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.15 | lib/rhcp/context.rb |
rhcp-0.2.14 | lib/rhcp/context.rb |