Module: TrickSerial::Serializer::CgiSession::FileStoreSerializer
- Includes:
- SessionStoreDataHook
- Defined in:
- lib/trick_serial/serializer/cgi_session.rb
Overview
FileStore can only handle String => String data. Use Marshal and Base64 to further encode it.
Constant Summary collapse
- PHONY_KEY =
'_'.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #_data ⇒ Object
- #_data=(x) ⇒ Object
-
#decode_with_trick_serial_serializer! ⇒ Object
$stderr.puts “#self encode => @hash=#@[email protected]”.
- #encode_with_trick_serial_serializer! ⇒ Object
Class Method Details
.included(target) ⇒ Object
196 197 198 199 |
# File 'lib/trick_serial/serializer/cgi_session.rb', line 196 def self.included target super require 'base64' end |
Instance Method Details
#_data ⇒ Object
201 |
# File 'lib/trick_serial/serializer/cgi_session.rb', line 201 def _data; @hash; end |
#_data=(x) ⇒ Object
202 |
# File 'lib/trick_serial/serializer/cgi_session.rb', line 202 def _data= x; @hash = x; end |
#decode_with_trick_serial_serializer! ⇒ Object
$stderr.puts “#self encode => @hash=#TrickSerial::Serializer::CgiSession::FileStoreSerializer.@[email protected]”
211 212 213 214 215 |
# File 'lib/trick_serial/serializer/cgi_session.rb', line 211 def decode_with_trick_serial_serializer! # $stderr.puts "#{self} decode <= @hash=#{@hash.inspect}" @hash &&= (v = @hash[PHONY_KEY]) ? Marshal.load(::Base64.decode64(v)) : { } # $stderr.puts "#{self} decode => @hash=#{@hash.inspect}" end |
#encode_with_trick_serial_serializer! ⇒ Object
206 207 208 209 210 |
# File 'lib/trick_serial/serializer/cgi_session.rb', line 206 def encode_with_trick_serial_serializer! # $stderr.puts "#{self} encode <= @hash=#{@hash.inspect}" @hash &&= { PHONY_KEY => ::Base64.encode64(Marshal.dump(@hash)).chomp! } # $stderr.puts "#{self} encode => @hash=#{@hash.inspect}" end |