coalescing_panda 5.1.0 → 5.1.2

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
  SHA1:
3
- metadata.gz: ca4769293181b5ee47471cc9051ad0b678915f71
4
- data.tar.gz: 60c8585ff7f5d28057b703a9ae7c5a85ab6dbdb7
3
+ metadata.gz: db38b8cdb32e3f3d41eab15a3df4542cb9feeb9b
4
+ data.tar.gz: 4cb1f0ec31e628852a3cfe2100b2ca31a91f94cd
5
5
  SHA512:
6
- metadata.gz: 6103b51481915a9d2719a87ff81c042a783d0111108e4c270fc3261a61008ab3683beaae3b2a9490450248fe882f4be75776d360219fe2dadb7377cc301f229f
7
- data.tar.gz: f434c3a048769d55b72fe0ba190c7033ce0429b0acbf3ec0ec1a2ea2bc920262de49ef9336feb5e236d1767237bd79dd4ccf6bf14765c79358faa24fa329e91c
6
+ metadata.gz: d05f38b6ab1f690c9b581c59da23814f6b2b505be56bf2ab057b3099dd15497d98de974ce9f43f779e6b59e863e825fb690d146121915da348484af391798518
7
+ data.tar.gz: 3663adb9a48a839fed284a7132083335578074ce210b382cbac8e6cb4a0a98aa59d0033ad4cc6b8116205143b13a787d5ed56fa65ca7eef0f7e38b9ec23e551c
@@ -158,9 +158,8 @@ module CoalescingPanda
158
158
  end
159
159
 
160
160
  def valid_session?
161
- [
162
- current_session&.persisted?,
163
- ].all?
161
+ return false unless current_session(create_missing: false)&.persisted?
162
+ true
164
163
  rescue SessionNonceMismatch
165
164
  false
166
165
  end
@@ -4,9 +4,9 @@ module CoalescingPanda
4
4
 
5
5
  def self.to_boolean(v)
6
6
  if Rails.version < '5.0'
7
- ActiveRecord::Type::Boolean.new.type_cast_from_user("0")
7
+ ActiveRecord::Type::Boolean.new.type_cast_from_user(v)
8
8
  else
9
- ActiveRecord::Type::Boolean.new.deserialize('0')
9
+ ActiveRecord::Type::Boolean.new.deserialize(v)
10
10
  end
11
11
  end
12
12
  end
@@ -26,7 +26,7 @@ module CoalescingPanda
26
26
  current_session.try(:save)
27
27
  end
28
28
 
29
- def current_session
29
+ def current_session(create_missing: true)
30
30
  return @current_session if @current_session.present?
31
31
 
32
32
  if params[:session_token]
@@ -47,7 +47,7 @@ module CoalescingPanda
47
47
  @current_session = find_or_create_session(key: session_key)
48
48
  end
49
49
 
50
- @current_session ||= find_or_create_session(key: :create)
50
+ @current_session ||= find_or_create_session(key: :create) if create_missing
51
51
 
52
52
  @current_session
53
53
  end
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '5.1.0'
2
+ VERSION = '5.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-09-14 00:00:00.000000000 Z
13
+ date: 2020-09-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails