protobuf 3.8.5.pre0 → 3.8.5
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 +4 -4
- data/lib/protobuf/enum.rb +14 -0
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/enum_spec.rb +14 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a2d88c4a85786eaf517ad597ebfb70b91f1569bbef3e6f84dbae3c133faafb5
|
4
|
+
data.tar.gz: cf7ff4963a35ce8d0cf3c8f67320aa8cbc05387f04c378d1d28b3dac49126978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40d09f68f221fc5d8793904dad243dbcfc7396c8c6618f09c5cceada2f1507aa20042f6fb27c7fa0871c4bfffd7ed03f8e01ade0e0cf5fb7af95279b20b526b5
|
7
|
+
data.tar.gz: 4aa8f7c8cb11ad68333d451fae4b1fd85bd9e62a928159491e868ada2be9a30436747a9842f8dffff799026a5480f1da465b915a9fa9dfd50c33a9513a8e98a5
|
data/lib/protobuf/enum.rb
CHANGED
@@ -259,6 +259,20 @@ module Protobuf
|
|
259
259
|
super(tag)
|
260
260
|
end
|
261
261
|
|
262
|
+
# Custom equality method since otherwise identical values from different
|
263
|
+
# enums will be considered equal by Integer's equality method (or
|
264
|
+
# Fixnum's on Ruby < 2.4.0).
|
265
|
+
#
|
266
|
+
def ==(other)
|
267
|
+
if other.is_a?(Protobuf::Enum)
|
268
|
+
parent_class == other.parent_class && tag == other.tag
|
269
|
+
elsif tag.class == other.class
|
270
|
+
tag == other
|
271
|
+
else
|
272
|
+
false
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
262
276
|
# Overriding the class so ActiveRecord/Arel visitor will visit the enum as an
|
263
277
|
# Integer.
|
264
278
|
#
|
data/lib/protobuf/version.rb
CHANGED
@@ -21,6 +21,20 @@ RSpec.describe Protobuf::Enum do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
describe '.==' do
|
25
|
+
it 'is true for identical values' do
|
26
|
+
expect(Test::EnumTestType::THREE).to eq(Test::EnumTestType::THREE)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is false for different values in the same enum' do
|
30
|
+
expect(Test::EnumTestType::TWO).to_not eq(Test::EnumTestType::THREE)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'is false for values from different enums' do
|
34
|
+
expect(Test::EnumTestType::THREE).to_not eq(Test::AliasedEnum::THREE)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
24
38
|
describe '.aliases_allowed?' do
|
25
39
|
it 'is false when the option is not set' do
|
26
40
|
expect(Test::EnumTestType.aliases_allowed?).to be false
|
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.5
|
4
|
+
version: 3.8.5
|
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-11-
|
14
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -463,12 +463,12 @@ 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:
|
468
|
+
version: '0'
|
469
469
|
requirements: []
|
470
470
|
rubyforge_project:
|
471
|
-
rubygems_version: 2.7.
|
471
|
+
rubygems_version: 2.7.8
|
472
472
|
signing_key:
|
473
473
|
specification_version: 4
|
474
474
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|