panda_pal 5.4.8 → 5.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54f85983099ebb935266fb0f7a5671dea933b70c02557af3af732dd63b81a603
4
- data.tar.gz: 2566905d0ddd340582f5e2171278c5d2bcde892d374c024cb7deba29b06d711a
3
+ metadata.gz: ab247586547b242a21faf1f5d26b8c58eee77f0893bca00c68b36c984f7d646e
4
+ data.tar.gz: 8929cb3f413b2bd3870b6f92fd7c73eba886e0d5f0c403e46d383d949b213b5d
5
5
  SHA512:
6
- metadata.gz: 9e52048202eda9ba571e496c909dc85cf961d89a45612d5fd5a80c085ee6fd4a83286058df4c0a953c3456ffea31927dfcfc14c77a628468492d6f0ca0bccb20
7
- data.tar.gz: d893fc73823f914ae8590311333660a8100357db27fc2510c1663a36dc8bf905bff4fc0dae1db0091ad8ef9656dec24a46e16e8852d7788cf6cb3b26d27045e8
6
+ metadata.gz: a446ff7233316b5bdd0629b8529391d92c58a6596bb5cdffa166c5f5727e50e27c6ebd11781b45abcbc0659a8f1b01349425d165dfbb7cefe5e98a613778ee00
7
+ data.tar.gz: 7dd81c73ae5d4c704289ecb172f5f4342531a2998a6e68d568dafc8ac88494d0f7e0638b35885a09c682dbac2cd9d670f1d984e9f9644e6b096f69bb5db5ed4d
@@ -8,6 +8,34 @@ module PandaPal
8
8
  self.session_key ||= SecureRandom.urlsafe_base64(60)
9
9
  end
10
10
 
11
- serialize :data, Hash
11
+ class DataSerializer
12
+ def self.load(str)
13
+ return nil unless str.present?
14
+ begin
15
+ parsed = JSON.parse(str)
16
+ rescue JSON::ParserError
17
+ parsed = yaml_load(str)
18
+ end
19
+ parsed.is_a?(Hash) ? HashWithIndifferentAccess.new(parsed) : parsed
20
+ end
21
+
22
+ def self.dump(obj)
23
+ JSON.dump(obj)
24
+ end
25
+
26
+ private
27
+
28
+ if YAML.respond_to?(:unsafe_load)
29
+ def self.yaml_load(payload)
30
+ YAML.unsafe_load(payload)
31
+ end
32
+ else
33
+ def self.yaml_load(payload)
34
+ YAML.load(payload)
35
+ end
36
+ end
37
+ end
38
+
39
+ serialize :data, DataSerializer
12
40
  end
13
41
  end
@@ -61,7 +61,7 @@ module PandaPal::Helpers
61
61
  end
62
62
 
63
63
  def current_session_data
64
- current_session.data&.with_indifferent_access
64
+ current_session.data
65
65
  end
66
66
 
67
67
  def session_changed?
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = "5.4.8"
2
+ VERSION = "5.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.8
4
+ version: 5.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure ProServe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails