Module: RackSessionManipulation::JSONEncoder
- Defined in:
- lib/rack_session_manipulation/json_encoder.rb
Overview
The stock encoder for session data. Encodes and decodes everything to/from JSON payloads.
Class Method Summary collapse
-
.decode(encoded_data) ⇒ Hash
Decoder for session state into a standard Ruby hash using JSON.
-
.encode(obj) ⇒ String
Encoder for session state using JSON.
Class Method Details
.decode(encoded_data) ⇒ Hash
Decoder for session state into a standard Ruby hash using JSON.
11 12 13 |
# File 'lib/rack_session_manipulation/json_encoder.rb', line 11 def decode(encoded_data) JSON.parse(encoded_data) end |
.encode(obj) ⇒ String
Encoder for session state using JSON.
20 21 22 |
# File 'lib/rack_session_manipulation/json_encoder.rb', line 20 def encode(obj) JSON.generate(obj) end |