protobuf 3.8.4 → 3.8.5.pre0

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: ed05b202c2cfac393096533ca5980e215ed2698043f44e5f1820ea3445ffe8d4
4
- data.tar.gz: ae0de25bd7bcbe52aaef1df049263f6e64e65702e55e66347aceba9a0b8cca94
3
+ metadata.gz: 36aed181d6bcd717ec7f3225b5aa6863b885834e928fb884fa078dc4227623e7
4
+ data.tar.gz: 9ec49612c7de625f50acaba9edcd3d912f5e81ba413d895f8176b1f1f98e6258
5
5
  SHA512:
6
- metadata.gz: a14ef672b0099a05ddd9cd7c823a2da550137fe47aae47decbfa136a032bfee1400cd755ee71739d2572dd94eea55617c8169bea373cbc0c57e2c5c7b0e5b320
7
- data.tar.gz: 2afb6adf6d555daa7da85b09da51723a6da78da680804091a8047c771b0641184bade5d147fee154d92e390b47da964ffea840927bab27bebda2ec3cd3fbaf94
6
+ metadata.gz: 4851081c3d661dbb4fcdff2bd65435024297b83613dc55ac18f512ad5f25d25d449abdb07f2f2c15213d5b9250cd8c77c3143888c9fecc6540af95d5597fa369
7
+ data.tar.gz: 529044b03838d84adfb4cbe10935dea8da89f8f56968a2f117d87f58ff24964dfb548b576a77593ebe0f3dd48b3b4c7197903e9f4da4281c521a70be70f3700d
@@ -271,6 +271,25 @@ module Protobuf
271
271
  tag.class
272
272
  end
273
273
 
274
+ # Protobuf::Enum delegates methods to Fixnum, which has a custom hash equality method (`eql?`)
275
+ # This causes enum values to be equivalent when using `==`, `===`, `equals?`, but not `eql?`**:
276
+ #
277
+ # 2.3.7 :002 > ::Test::EnumTestType::ZERO.eql?(::Test::EnumTestType::ZERO)
278
+ # => false
279
+ #
280
+ # However, they are equilvalent to their tag value:
281
+ #
282
+ # 2.3.7 :002 > ::Test::EnumTestType::ZERO.eql?(::Test::EnumTestType::ZERO.tag)
283
+ # => true
284
+ #
285
+ # **The implementation changed in Ruby 2.5, so this only affects Ruby versions less than v2.4.
286
+ #
287
+ # Use the hash equality implementation from Object#eql?, which is equivalent to == instead.
288
+ #
289
+ def eql?(other)
290
+ self == other
291
+ end
292
+
274
293
  def inspect
275
294
  "\#<Protobuf::Enum(#{parent_class})::#{name}=#{tag}>"
276
295
  end
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.8.4' # rubocop:disable Style/MutableConstant
2
+ VERSION = '3.8.5.pre0' # rubocop:disable Style/MutableConstant
3
3
  end
@@ -268,6 +268,20 @@ RSpec.describe Protobuf::Enum do
268
268
  specify { subject.try { |yielded| expect(yielded).to eq(subject) } }
269
269
  end
270
270
 
271
+ describe '#eql?' do
272
+ it "is equal to itself" do
273
+ expect(::Test::EnumTestType::ZERO.eql?(::Test::EnumTestType::ZERO)).to be(true)
274
+ end
275
+
276
+ it "is equal to it's tag" do
277
+ expect(::Test::EnumTestType::ZERO.eql?(::Test::EnumTestType::ZERO.tag)).to be(true)
278
+ end
279
+
280
+ it "is not equal to it's name" do
281
+ expect(::Test::EnumTestType::ZERO.eql?(::Test::EnumTestType::ZERO.name)).to be(false)
282
+ end
283
+ end
284
+
271
285
  context 'when coercing from enum' do
272
286
  subject { Test::StatusType::PENDING }
273
287
  it { is_expected.to eq(0) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.4
4
+ version: 3.8.5.pre0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-06-12 00:00:00.000000000 Z
14
+ date: 2018-11-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -463,9 +463,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
463
463
  version: '0'
464
464
  required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  requirements:
466
- - - ">="
466
+ - - ">"
467
467
  - !ruby/object:Gem::Version
468
- version: '0'
468
+ version: 1.3.1
469
469
  requirements: []
470
470
  rubyforge_project:
471
471
  rubygems_version: 2.7.6