Class: RedisRpc::Parser
- Inherits:
-
Object
- Object
- RedisRpc::Parser
- Defined in:
- lib/redis_rpc/parser.rb
Instance Attribute Summary collapse
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize(secret_key) ⇒ Parser
constructor
A new instance of Parser.
- #pack(args) ⇒ Object
- #parse(args) ⇒ Object
Constructor Details
#initialize(secret_key) ⇒ Parser
Returns a new instance of Parser.
10 11 12 13 |
# File 'lib/redis_rpc/parser.rb', line 10 def initialize(secret_key) @secret_key = secret_key @aes = Base64Aes.new(@secret_key) if !@secret_key.nil? end |
Instance Attribute Details
#secret_key ⇒ Object
Returns the value of attribute secret_key.
8 9 10 |
# File 'lib/redis_rpc/parser.rb', line 8 def secret_key @secret_key end |
Instance Method Details
#pack(args) ⇒ Object
20 21 22 23 |
# File 'lib/redis_rpc/parser.rb', line 20 def pack(args) args = @aes.encrypt(args) if !@secret_key.nil? args end |
#parse(args) ⇒ Object
15 16 17 18 |
# File 'lib/redis_rpc/parser.rb', line 15 def parse(args) args = @aes.decrypt(args) if !@secret_key.nil? _args = JSON.parse(args, symbolize_names: true) end |