switchman 1.5.19 → 1.5.20

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
  SHA1:
3
- metadata.gz: 65bb936a3b1c3df9044c0c8429a6e7b01b0bafb3
4
- data.tar.gz: a1e4e5e2c846e10fd95f1916a175b5327e4429d1
3
+ metadata.gz: f93ffdf39f2476bbca446bd460d92929f405fd20
4
+ data.tar.gz: b9474a6f15ce63eca588224f8b079481628b5cea
5
5
  SHA512:
6
- metadata.gz: 3d7888becfe60dd1e14255cfca4c3492268ea4048133819a2aa40de66c696b0dd6c4965c66eb82bb68603346afdc43b3f5b8ee636da2ff36a58db7bd0628a52c
7
- data.tar.gz: bf563c2246872f3afb630f93e08906b55f8e6e7f63a92cd0c765cd87a1fb21120634b375a011fa5b29793c293400ccc96bca83d4796025d15d6985ccc138825f
6
+ metadata.gz: 69ab7d6917a101adbd9b7d2d52c86da2c1c24d3acbc44410aab2068ec9e24ad45bae9e4fcc89db8d4b9d6d67107e3ccfadbe4adfdfefe4a70409c66dcc6233c7
7
+ data.tar.gz: 4144225d20c804a42d22e952afa493ebaafc537a7dc72a9836d6026940a375222ea534d6513538a03ae51eac2b1c8e4ace3cb7ae9bbcac8c7252fdc06673b083
@@ -451,7 +451,8 @@ module Switchman
451
451
 
452
452
  # takes an id-ish, and returns a local id and the shard it's
453
453
  # local to. [nil, nil] if it can't be interpreted. [id, nil]
454
- # if it's already a local ID
454
+ # if it's already a local ID. [nil, nil] if it's a well formed
455
+ # id, but the shard it refers to does not exist
455
456
  NIL_NIL_ID = [nil, nil].freeze
456
457
  def local_id_for(any_id)
457
458
  id = integral_id_for(any_id)
@@ -466,10 +467,13 @@ module Switchman
466
467
  end
467
468
 
468
469
  # takes an id-ish, and returns an integral id relative to
469
- # target_shard. returns any_id itself if it can't be interpreted
470
+ # target_shard. returns nil if it can't be interpreted,
471
+ # or the integral version of the id if it refers to a shard
472
+ # that does not exist
470
473
  def relative_id_for(any_id, source_shard, target_shard)
471
- local_id, shard = local_id_for(any_id)
472
- return any_id unless local_id
474
+ integral_id = integral_id_for(any_id)
475
+ local_id, shard = local_id_for(integral_id)
476
+ return integral_id unless local_id
473
477
  shard ||= source_shard
474
478
  return local_id if shard == target_shard
475
479
  shard.global_id_for(local_id)
@@ -295,6 +295,7 @@ module Switchman
295
295
  local_ids = []
296
296
  predicate.right.each do |value|
297
297
  local_id = Shard.relative_id_for(value, current_source_shard, target_shard)
298
+ next unless local_id
298
299
  unless remove && local_id > Shard::IDS_PER_SHARD
299
300
  if ::Rails.version > "4.2" && value.is_a?(::Arel::Nodes::Casted)
300
301
  if local_id == value.val
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.5.19"
2
+ VERSION = "1.5.20"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.19
4
+ version: 1.5.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-30 00:00:00.000000000 Z
13
+ date: 2016-09-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties