protobuf 3.10.6 → 3.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/spec/lib/protobuf/generators/enum_generator_spec.rb +11 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +11 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f345ac51b45d74ca337c48e64d8ffb42e2447827e9fa5b483a7602ef47cc6743
|
4
|
+
data.tar.gz: d5ac75f75f3e27c75d4ad2066bd5160df7288136fd5c87323a7918034c025adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c4eb8312892d27bbb8f0f2917a63fd40519c3d6b3e36eb8825128d086d2913fe73f0d3db6acf035086a4b628ffe7ed3d838718f3301061edbf21f5bca81edb
|
7
|
+
data.tar.gz: 6fa9ec62ef8a47feec93a6b9f6b2c1cad220b1dd2001dd4b96a5ac75c1a3f7b81a2c7ee4342244e61ba649a7d075e572991bb162ff1b85cb6f2d5cf974e63d7c
|
@@ -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
@@ -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\"" }
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
8
8
|
- Brandon Dewitt
|
9
9
|
- Devin Christensen
|
10
10
|
- Adam Hutchison
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -471,7 +471,7 @@ homepage: https://github.com/localshred/protobuf
|
|
471
471
|
licenses:
|
472
472
|
- MIT
|
473
473
|
metadata: {}
|
474
|
-
post_install_message:
|
474
|
+
post_install_message:
|
475
475
|
rdoc_options: []
|
476
476
|
require_paths:
|
477
477
|
- lib
|
@@ -486,8 +486,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
486
|
- !ruby/object:Gem::Version
|
487
487
|
version: '0'
|
488
488
|
requirements: []
|
489
|
-
rubygems_version: 3.
|
490
|
-
signing_key:
|
489
|
+
rubygems_version: 3.1.4
|
490
|
+
signing_key:
|
491
491
|
specification_version: 4
|
492
492
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|
493
493
|
test_files:
|