pgbus 0.3.9 → 0.4.0

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: 0dd5ee830e98f086b75601600307b11a2729d20076495563151ba6a0745b43bd
4
- data.tar.gz: 2bb7b5f38f4a2c3186aae1406f7aa843a7d18601aab1065dbbcc3303784682e8
3
+ metadata.gz: 6319135c38b3b309f4dfabfe1debcc24da94666a46a058232126d9866f112f39
4
+ data.tar.gz: a8bb02e1b78719985a8c393e715dca1231ecaaf1fe9c3cd74f8724298a20a9b1
5
5
  SHA512:
6
- metadata.gz: e33636a93205ce7bb09bef53b626bb275905c980cf6792ec9716baed0bc3265d150816dcaffd5f77f6cd08541ab03fceb0cf76315e9bce9ad4bfe76035b4dad8
7
- data.tar.gz: 1aff3f96586bc6a8593cac6cb7ea7f7206899ee1d43907b3717f9cd1433cc9c818537f6ad1d8ecad2dad7f492dbb216d17c0e4b80dd0276f6a45b5e4c619dc6d
6
+ metadata.gz: e7512e025266148649b572902ccab8ade0fe0752e75fa2393b9ac291e3e99f3de79209adf38a49adf82f63bf389f7b263ad0c11e85602344696cc339b09e539c
7
+ data.tar.gz: 3e30288c34b71dfdd405a82c5a452ebf511600f8dd02d7094527c053f0f0eb59a02775ac367e6eee8d99dfa4093f7ae524dec92dea8b17c12c3d5c49927aef59
@@ -81,11 +81,16 @@ module Pgbus
81
81
 
82
82
  args = active_job.arguments
83
83
  last = args.last
84
- if last.is_a?(Hash) && last.each_key.all?(Symbol)
85
- config[:key].call(*args[...-1], **last)
86
- else
87
- config[:key].call(*args)
88
- end
84
+ key = if last.is_a?(Hash) && last.each_key.all?(Symbol)
85
+ config[:key].call(*args[...-1], **last)
86
+ else
87
+ config[:key].call(*args)
88
+ end
89
+
90
+ # Automatically serialize GlobalID-compatible objects (e.g. ActiveRecord models)
91
+ # so users can pass model instances directly without manual .to_global_id.to_s
92
+ key = key.to_global_id.to_s if key.respond_to?(:to_global_id)
93
+ key
89
94
  end
90
95
 
91
96
  def inject_metadata(active_job, payload_hash)
data/lib/pgbus/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pgbus
4
- VERSION = "0.3.9"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson