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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37eb48c5ccc33b4bd808e09f0ef7ba16b97e9c1c8a1e6117410a03943350a35c
4
- data.tar.gz: 0b0554a289bb6bcf5e579ae87599ece00eaee25734fb95b3353f5583a8751726
3
+ metadata.gz: b7114d15b11a82b810c6ad7fc43c7091b37899aa4593da49119a68409f6a83bd
4
+ data.tar.gz: b0a21a157f5a7c75da7e0f4e72298b7e93591165ed5a7aac682aef81c6d53049
5
5
  SHA512:
6
- metadata.gz: 229141372593250bccf5e3e8656108a44a0ea591900914daaf04a5017bd801ab8be3175e3bdab5ceaeb7fd6824d636eb597018d0bc86e51c874bd864d474e74c
7
- data.tar.gz: f28efc4898d20ec4a83c13a67001c6bbf9e28773712f9dd1c30405a879e0aed9d114d5689ce462d42c756f9fb344cf9256670f904ece8edb2cf9055ad8c19979
6
+ metadata.gz: d0322e24fb36d5b50805a2045c97575bf4c117982b234d8d3d05190d37b363459a911c5c497ceacd6fce64b153c4593e3f66acb2495385643e775c478c853392
7
+ data.tar.gz: 33884fa65b87180f786b21472259dc812c623c23bff668588b73bc434e4f7d3881f8533109300084c5f80a04d16e70892bf32a2731b056ec53ae68fb28523663
@@ -1,5 +1,5 @@
1
- //= link_directory ../images/lato .jpg
2
1
  //= link_directory ../stylesheets/lato .css
2
+ //= link_directory ../images/lato .jpg
3
3
  //= link_tree ../javascripts/lato .js
4
4
  //#= link popper.js
5
5
  //= link bootstrap.js
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
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.2
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-10-20 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails