lato 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/lato_manifest.js +1 -1
- data/app/models/lato/session.rb +13 -5
- data/lib/lato/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7114d15b11a82b810c6ad7fc43c7091b37899aa4593da49119a68409f6a83bd
|
4
|
+
data.tar.gz: b0a21a157f5a7c75da7e0f4e72298b7e93591165ed5a7aac682aef81c6d53049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0322e24fb36d5b50805a2045c97575bf4c117982b234d8d3d05190d37b363459a911c5c497ceacd6fce64b153c4593e3f66acb2495385643e775c478c853392
|
7
|
+
data.tar.gz: 33884fa65b87180f786b21472259dc812c623c23bff668588b73bc434e4f7d3881f8533109300084c5f80a04d16e70892bf32a2731b056ec53ae68fb28523663
|
data/app/models/lato/session.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Lato
|
2
2
|
class Session
|
3
3
|
def initialize(session)
|
4
|
-
@session = session
|
4
|
+
@session = parse_session(session)
|
5
5
|
end
|
6
6
|
|
7
7
|
# Questions
|
@@ -19,18 +19,26 @@ module Lato
|
|
19
19
|
##
|
20
20
|
|
21
21
|
def user
|
22
|
-
@user ||= Lato::User.find_by(id: @session)
|
22
|
+
@user ||= Lato::User.find_by(id: @session[:user_id])
|
23
23
|
end
|
24
24
|
|
25
25
|
def user_id
|
26
|
-
@session
|
26
|
+
@session&.dig(:user_id)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Class
|
30
30
|
##
|
31
31
|
|
32
|
-
def self.generate_session_per_user(user_id)
|
33
|
-
user_id
|
32
|
+
def self.generate_session_per_user(user_id, extra_params = {})
|
33
|
+
extra_params.merge(user_id: user_id).to_json
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def parse_session(session)
|
39
|
+
return nil if session.blank?
|
40
|
+
|
41
|
+
(session.is_a?(String) ? JSON.parse(session) : session).with_indifferent_access
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
data/lib/lato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|