protobuf 3.10.6 → 3.10.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 +4 -4
- data/lib/protobuf/cli.rb +1 -0
- data/lib/protobuf/code_generator.rb +1 -0
- data/lib/protobuf/deprecation.rb +1 -0
- data/lib/protobuf/field/base_field.rb +1 -0
- data/lib/protobuf/generators/enum_generator.rb +1 -0
- data/lib/protobuf/generators/field_generator.rb +2 -0
- data/lib/protobuf/version.rb +1 -1
- data/lib/protobuf.rb +1 -0
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +11 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +11 -0
- data/spec/support/server.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c5dfe944c45e6d2ae26771385b8bfe7719efe4efd6576d0f95866319872342e
|
4
|
+
data.tar.gz: aa4bb74aadc1e5d2462db9df39b8b931e2382478078f4c84aa4c22d1d2145252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b225ea3a368cec4e619d8b117dc8eb1e11fe913ce1563c254c8530a6b18abb6109a5c4aaace7c1fbd7f774df302fce9d182c5db166e5e013e9e8d18334d0fc6
|
7
|
+
data.tar.gz: 2450cdba292656144044d49098f9c95cc8e487cf27843ab99abf2d99c1f0478d566b65f181ac87babb05aeab2f62f5cea611d41d717e10eeeaccef59c4cf1f25
|
data/lib/protobuf/cli.rb
CHANGED
data/lib/protobuf/deprecation.rb
CHANGED
@@ -29,6 +29,7 @@ module Protobuf
|
|
29
29
|
|
30
30
|
def build_value(enum_value_descriptor)
|
31
31
|
name = enum_value_descriptor.name
|
32
|
+
name.capitalize! if ENV.key?('PB_CAPITALIZE_ENUMS')
|
32
33
|
name.upcase! if ENV.key?('PB_UPCASE_ENUMS')
|
33
34
|
number = enum_value_descriptor.number
|
34
35
|
"define :#{name}, #{number}"
|
data/lib/protobuf/version.rb
CHANGED
data/lib/protobuf.rb
CHANGED
@@ -71,12 +71,23 @@ end
|
|
71
71
|
|
72
72
|
context 'with PB_UPCASE_ENUMS set' do
|
73
73
|
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(true) }
|
74
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(false) }
|
74
75
|
let(:values) { [{ :name => 'boom', :number => 1 }] }
|
75
76
|
|
76
77
|
it 'returns a string with the given enum name in ALL CAPS' do
|
77
78
|
expect(subject.build_value(enum.value.first)).to eq("define :BOOM, 1")
|
78
79
|
end
|
79
80
|
end
|
81
|
+
|
82
|
+
context 'with PB_CAPITALIZE_ENUMS set' do
|
83
|
+
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(false) }
|
84
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(true) }
|
85
|
+
let(:values) { [{ :name => 'boom', :number => 1 }] }
|
86
|
+
|
87
|
+
it 'returns a string with the given enum name in ALL CAPS' do
|
88
|
+
expect(subject.build_value(enum.value.first)).to eq("define :Boom, 1")
|
89
|
+
end
|
90
|
+
end
|
80
91
|
end
|
81
92
|
|
82
93
|
end
|
@@ -67,10 +67,21 @@ RSpec.describe ::Protobuf::Generators::FieldGenerator do
|
|
67
67
|
let(:type_name) { '.foo.bar.Baz' }
|
68
68
|
let(:default_value) { 'quux' }
|
69
69
|
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(true) }
|
70
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(false) }
|
70
71
|
|
71
72
|
specify { expect(subject).to eq " optional ::Foo::Bar::Baz, :foo_bar, 3, :default => ::Foo::Bar::Baz::QUUX\n" }
|
72
73
|
end
|
73
74
|
|
75
|
+
context 'when type is an enum with lowercase default value with PB_CAPITALIZE_ENUMS set' do
|
76
|
+
let(:type_enum) { :TYPE_ENUM }
|
77
|
+
let(:type_name) { '.foo.bar.Baz' }
|
78
|
+
let(:default_value) { 'quux' }
|
79
|
+
before { allow(ENV).to receive(:key?).with('PB_UPCASE_ENUMS').and_return(false) }
|
80
|
+
before { allow(ENV).to receive(:key?).with('PB_CAPITALIZE_ENUMS').and_return(true) }
|
81
|
+
|
82
|
+
specify { expect(subject).to eq " optional ::Foo::Bar::Baz, :foo_bar, 3, :default => ::Foo::Bar::Baz::Quux\n" }
|
83
|
+
end
|
84
|
+
|
74
85
|
context 'when the type is a string' do
|
75
86
|
let(:type_enum) { :TYPE_STRING }
|
76
87
|
let(:default_value) { "a default \"string\"" }
|
data/spec/support/server.rb
CHANGED
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.10.
|
4
|
+
version: 3.10.8
|
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:
|
14
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -486,7 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
486
|
- !ruby/object:Gem::Version
|
487
487
|
version: '0'
|
488
488
|
requirements: []
|
489
|
-
rubygems_version: 3.2.
|
489
|
+
rubygems_version: 3.2.33
|
490
490
|
signing_key:
|
491
491
|
specification_version: 4
|
492
492
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|