lato 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 288d8c5087ad55acbc2bd7e40a3a4dbbea45592d89b1bab4ca04fcbb367876eb
4
- data.tar.gz: b64204ee59d0ff500f26bd37605a0d903f713dba4e4c9fb9aa6ff25395733f43
3
+ metadata.gz: b7114d15b11a82b810c6ad7fc43c7091b37899aa4593da49119a68409f6a83bd
4
+ data.tar.gz: b0a21a157f5a7c75da7e0f4e72298b7e93591165ed5a7aac682aef81c6d53049
5
5
  SHA512:
6
- metadata.gz: b12c8cdbd45308fd565669c44b160f99fcbdf02dab34f554b9bc6b278e000d674111b67ea6d802627cef73d341a8fbd44937e0babdd29f985f1f1b35e40975c5
7
- data.tar.gz: 453e2ec441176eddaa105606ddf68aed5ae116cbd8b0cfb162bf6029f1eca5fbdd1cc6a29e1349ca6b42dd8b3d9da5a7feea49a9fdb4c4bfc499442e0b78687f
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.1"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -81,7 +81,7 @@ self.addEventListener('fetch', onFetch);
81
81
  namespace :generate do
82
82
  desc "Generate PWA icons from a single icon.png file (512x512) that should be placed inside 'public' folder"
83
83
  # Usage: rails lato:generate:pwa
84
- task :pwa do
84
+ task pwa: :environment do
85
85
  # check if icon.png exists
86
86
  icon_path = Rails.root.join('public', 'icon.png')
87
87
  unless File.exist? icon_path
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.1
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-19 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