surfliner-metadata_consumer 0.1.0.pre.alpha.7 → 0.1.0.pre.alpha.8

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: c496d7587eb02bc3020be31fb8a9052e67e52aa08b97c3dbc81bb26d44f29fc3
4
- data.tar.gz: 57d58bc7f428b049efc1e1f4db521970a8f43e389b966c20fb99156313c6c085
3
+ metadata.gz: f209e4cf680ce23da67c4caa19fd9448fed117ec03e38d54b50a382b1b6b72a0
4
+ data.tar.gz: 07a901ae1f7edda577c3cbd272aac1d68e7a31876ee536661b8586c55a0623d4
5
5
  SHA512:
6
- metadata.gz: ebb4d7a8b61f8b03d4376454a526921d19e18eb94cca49029e8e75736ddee0ec61372a6bde72fafda21162eaa4f0ef655dc759f90150c309c8e20ec5404b450b
7
- data.tar.gz: 43a75ff273881bf59ea4c20ae84e299b853b8c6779bc03e48e6fd42d6846a9268236aa034234ce8db6275ce600b255cac5eff23d722540496bc531347a589e7a
6
+ metadata.gz: 5531263f0ddcac33d04d8ba55d9008b2e1562eda7288f49273631661038d1f61c858030bad5d6ec5dc8f51bd24f7e7ad34be5430eceba021ccfa21013771cece
7
+ data.tar.gz: 0f9d4c233b2b4be9410509772715c742e76717dbd5f124ca1b693965548d169f033734d262b67dfaa117246e6101a238f0b4894e20b5cfdfbc787c5865e18147
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.0.pre.alpha.8 (2025-04-29)
2
+
3
+ - Support comparing configuration objects by value equality, so they can
4
+ be used as hash keys.
5
+
1
6
  # 0.1.0.pre.alpha.7 (2025-04-28)
2
7
 
3
8
  - Fix issue where `RABBITMQ_AWAIT_ON_CLOSE` environment variable could
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- surfliner-metadata_consumer (0.1.0.pre.alpha.7)
4
+ surfliner-metadata_consumer (0.1.0.pre.alpha.8)
5
5
  bunny (~> 2.24)
6
6
  opentelemetry-exporter-otlp (~> 0.26.3)
7
7
  opentelemetry-instrumentation-all (~> 0.60.0)
data/README.md CHANGED
@@ -91,7 +91,7 @@ And `QueueConfig#from_env` similarly accepts keyword options, which are forwarde
91
91
 
92
92
  ```ruby
93
93
  connection.with_topic(topic_config) do |topic|
94
- queue_config = QueueConfig.from_env(exclusive: true, durable: true)
94
+ queue_config = QueueConfig.from_env(exclusive: true, durable: false)
95
95
  queue = topic.bind_queue(queue_config)
96
96
  # ...
97
97
  end
@@ -2,6 +2,6 @@
2
2
  module Surfliner
3
3
  module MetadataConsumer
4
4
  # The gem version
5
- VERSION = "0.1.0.pre.alpha.7"
5
+ VERSION = "0.1.0.pre.alpha.8"
6
6
  end
7
7
  end
@@ -28,7 +28,7 @@ module Surfliner
28
28
  # @param port [String] RabbitMQ AMQP port
29
29
  # @param username [String] RabbitMQ username
30
30
  # @param password [String] RabbitMQ passsword
31
- # @param await_response_on_close [Boolean] whether the RabbitMQ client should wait for a response when closing the connection
31
+ # @param await_response_on_close [Boolean, String] whether the RabbitMQ client should wait for a response when closing the connection
32
32
  # @param opts [Hash] additional RabbitMQ conection options (see Bunny::Session#initialize)
33
33
  def initialize(host:, port:, username:, password:, await_response_on_close: true, **opts)
34
34
  @host = host
@@ -74,7 +74,34 @@ module Surfliner
74
74
  @redacted_url ||= session_url.sub(password, "REDACTED")
75
75
  end
76
76
 
77
- private
77
+ # Whether `other` represents the same configuration as this object.
78
+ # Note that if any attributes or connection options are modified, equality becomes unstable.
79
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
80
+ def eql?(other)
81
+ self == other
82
+ end
83
+
84
+ # Whether `other` represents the same configuration as this object.
85
+ # Note that if any attributes or connection options are modified, equality becomes unstable.
86
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
87
+ def ==(other)
88
+ return unless other.class == self.class
89
+ other.options == options
90
+ end
91
+
92
+ # The hash value of this object. Equal configurations will have equal hash values.
93
+ # Note that if any attributes or connection options are modified, the hash value becomes unstable.
94
+ # @return [Integer] a hash value suitable for using equal configs as hash keys
95
+ def hash
96
+ options.hash
97
+ end
98
+
99
+ protected
100
+
101
+ # @return [Hash] all keyword arguments and connection options, for purposes of equality checking
102
+ def options
103
+ {host:, port:, username:, password:, await_response_on_close:, opts:}
104
+ end
78
105
 
79
106
  def parse_boolean(v)
80
107
  !FALSE_VALUES.include?(v.to_s)
@@ -15,6 +15,30 @@ module Surfliner
15
15
  @options = options
16
16
  end
17
17
 
18
+ # Whether `other` represents the same configuration as this object.
19
+ # Note that if `name` or `options` are modified, equality becomes unstable.
20
+ # @param other [Object, nil] the object to compare
21
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
22
+ def eql?(other)
23
+ self == other
24
+ end
25
+
26
+ # Whether `other` represents the same configuration as this object.
27
+ # Note that if `name` or `options` are modified, equality becomes unstable.
28
+ # @param other [Object, nil] the object to compare
29
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
30
+ def ==(other)
31
+ return unless other.class == self.class
32
+ other.name == name && other.options == options
33
+ end
34
+
35
+ # The hash value of this object. Equal configurations will have equal hash values.
36
+ # Note that if `name` or `options` are modified, the hash value becomes unstable.
37
+ # @return [Integer] a hash value suitable for using equal configs as hash keys
38
+ def hash
39
+ [name, options].hash
40
+ end
41
+
18
42
  class << self
19
43
  # Returns a default (environment-variable-based) configuration with the
20
44
  # specified options.
@@ -15,6 +15,30 @@ module Surfliner
15
15
  @options = options
16
16
  end
17
17
 
18
+ # Whether `other` represents the same configuration as this object.
19
+ # Note that if `name` or `options` are modified, equality becomes unstable.
20
+ # @param other [Object, nil] the object to compare
21
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
22
+ def eql?(other)
23
+ self == other
24
+ end
25
+
26
+ # Whether `other` represents the same configuration as this object.
27
+ # Note that if `name` or `options` are modified, equality becomes unstable.
28
+ # @param other [Object, nil] the object to compare
29
+ # @return [Boolean] true if `other` represents the same configuration as this object, false otherwise
30
+ def ==(other)
31
+ return unless other.class == self.class
32
+ other.name == name && other.options == options
33
+ end
34
+
35
+ # The hash value of this object. Equal configurations will have equal hash values.
36
+ # Note that if `name` or `options` are modified, the hash value becomes unstable.
37
+ # @return [Integer] a hash value suitable for using equal configs as hash keys
38
+ def hash
39
+ [name, options].hash
40
+ end
41
+
18
42
  class << self
19
43
  # Returns a default (environment-variable-based) configuration with the
20
44
  # specified options.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surfliner-metadata_consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.7
4
+ version: 0.1.0.pre.alpha.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Project Surfliner