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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ea13b6353fc56a116dc91e87662ffaaac8c4b8cb27dd85be480797e7ef922d2
4
- data.tar.gz: 6f5804860b80527356f1a6cec79def05499abd4a5536038c453e7e65cd05c237
3
+ metadata.gz: f345ac51b45d74ca337c48e64d8ffb42e2447827e9fa5b483a7602ef47cc6743
4
+ data.tar.gz: d5ac75f75f3e27c75d4ad2066bd5160df7288136fd5c87323a7918034c025adb
5
5
  SHA512:
6
- metadata.gz: a49491b32df80049107f59673008d6f8ac64977abcae332ad407c120f9f9628f4c3b47dbd5f809b8843ce477e02286da3fc1242131a8919ddac7170e2002bbf4
7
- data.tar.gz: b5352584a6c79b77ce1360fb0ce6a03c00a165cdfb8f92b96aaf61d37a3acf7a89f7bd4bd2fc8a3f1c879434b941db3e0689040edf5988cee2c05cb5bfd0a3a5
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}"
@@ -140,6 +140,8 @@ module Protobuf
140
140
  optionally_upcased_default =
141
141
  if ENV.key?('PB_UPCASE_ENUMS')
142
142
  verbatim_default_value.upcase
143
+ elsif ENV.key?('PB_CAPITALIZE_ENUMS')
144
+ verbatim_default_value.capitalize
143
145
  else
144
146
  verbatim_default_value
145
147
  end
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.10.6' # rubocop:disable Style/MutableConstant
2
+ VERSION = '3.10.7' # rubocop:disable Style/MutableConstant
3
3
  end
@@ -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.6
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-04-27 00:00:00.000000000 Z
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.2.28
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: