statesman 7.2.0 → 7.3.0

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: 421da0e6d201060df4733a0e52e2742df2b1d527f241873dfd4b820c74cc587f
4
- data.tar.gz: 20cd64e291373c21b83886cfdc12c7e68450759515557f3853bfc68bfff8ed38
3
+ metadata.gz: 444b828dd17ce5984d99e93e25ff774ccbc621a06d0afeb51dc6d8a4b7cd0bc5
4
+ data.tar.gz: 8e70e4e74a6edc795d66f203619974c1483d8b2a3b02a19e5264ba588e991a37
5
5
  SHA512:
6
- metadata.gz: c48d5415915aee8e4f595b78b9018b9a048bfb3d8e3ff33a3efce0ba962540f71af1fe982a389d5b51104c8284fc485f4bfa62390a3c92f03fa7ce4592a2ffbf
7
- data.tar.gz: cf11b1793461381b835efe9b2343b54c348a01de85fc0cbd63623a0c18cf21f9935f6cb4251d9117a7d73b52df7041458a943d160628073afc96eb5c16237d73
6
+ metadata.gz: 9e354a540525c8ab3a2c2f0de4b7c6eb4ecc931f54e1d46dca64f03e910a3f95267f94fb61584444f53e37891ac5a8bd75a2054001eaff118a8a3c5eccad6be3
7
+ data.tar.gz: 1f2266d2181d451621ca355c9c5e8db982548f0028c65af723e3d9164deb43f1516e1550fd11678f99b5243e47302ee5fcd916cc2b0f9fb6f7dc9a4a8edb6218
@@ -113,7 +113,7 @@ module Statesman
113
113
  to_state: to,
114
114
  sort_key: next_sort_key,
115
115
  metadata: metadata,
116
- most_recent: not_most_recent_value,
116
+ most_recent: not_most_recent_value(db_cast: false),
117
117
  }
118
118
  end
119
119
 
@@ -316,6 +316,10 @@ module Statesman
316
316
  ::ActiveRecord::Base.connection.quote(value)
317
317
  end
318
318
 
319
+ def db_null
320
+ Arel::Nodes::SqlLiteral.new("NULL")
321
+ end
322
+
319
323
  # Check whether the `most_recent` column allows null values. If it doesn't, set old
320
324
  # records to `false`, otherwise, set them to `NULL`.
321
325
  #
@@ -323,10 +327,12 @@ module Statesman
323
327
  # indexes. By doing the conditioning on the column, rather than Rails' opinion of
324
328
  # whether the database supports partial indexes, we're robust to DBs later adding
325
329
  # support for partial indexes.
326
- def not_most_recent_value
327
- return db_false if transition_class.columns_hash["most_recent"].null == false
330
+ def not_most_recent_value(db_cast: true)
331
+ if transition_class.columns_hash["most_recent"].null == false
332
+ return db_cast ? db_false : false
333
+ end
328
334
 
329
- nil
335
+ db_cast ? db_null : nil
330
336
  end
331
337
  end
332
338
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Statesman
4
- VERSION = "7.2.0"
4
+ VERSION = "7.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ammeter
@@ -283,7 +283,7 @@ homepage: https://github.com/gocardless/statesman
283
283
  licenses:
284
284
  - MIT
285
285
  metadata: {}
286
- post_install_message:
286
+ post_install_message:
287
287
  rdoc_options: []
288
288
  require_paths:
289
289
  - lib
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  version: '0'
300
300
  requirements: []
301
301
  rubygems_version: 3.1.1
302
- signing_key:
302
+ signing_key:
303
303
  specification_version: 4
304
304
  summary: A statesman-like state machine library
305
305
  test_files: