protobuf 3.7.0.pre1 → 3.7.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/lib/protobuf/field/base_field.rb +1 -1
- data/lib/protobuf/message.rb +5 -1
- data/lib/protobuf/rpc/connectors/zmq.rb +1 -1
- data/lib/protobuf/rpc/service_directory.rb +8 -0
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/message_spec.rb +44 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eb324f0fa537308f4f06735a42fe4a73f1483e4
|
4
|
+
data.tar.gz: e1067403611fd86bf86b064115cbd42651aa68d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74422c44f167336cb16897fbe21c77eb89f663f5e4217759eff2499ef2889fffd05529f49ef1586378927b23919f7d97d41bc69b9e187694a72366ddb2bff234
|
7
|
+
data.tar.gz: 9a5436e3e9ead8917e9cff660674494a31e6522d4ba53b9ea31c6ad1643b946507dc947c5878678eda997ae2c70543e71923e7b2727b8801c527754bdc71dac4
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Stable (3.x)
|
2
2
|
|
3
|
+
3.7.0 (pre2)
|
4
|
+
-----------
|
5
|
+
- BUG: Track if a repeated field has been deliberately set (#325)
|
6
|
+
|
3
7
|
3.7.0 (pre1)
|
4
8
|
-----------
|
5
9
|
- BUG: Revert to old behavior for setting repeated fields to nil
|
@@ -16,6 +20,10 @@
|
|
16
20
|
- Refresh google/protobuf/descriptor.{proto,pb.rb}
|
17
21
|
- Properly encode and decode negative enum values.
|
18
22
|
|
23
|
+
3.6.9
|
24
|
+
--------
|
25
|
+
- Make protobuf serivce directory pluggable.
|
26
|
+
|
19
27
|
3.6.7
|
20
28
|
-----
|
21
29
|
- An issue was reported with the encode memoization added in #293 with using any array modification
|
@@ -176,7 +176,7 @@ module Protobuf
|
|
176
176
|
def define_accessor(simple_field_name, fully_qualified_field_name)
|
177
177
|
message_class.class_eval do
|
178
178
|
define_method("#{simple_field_name}!") do
|
179
|
-
@values[fully_qualified_field_name]
|
179
|
+
@values[fully_qualified_field_name] if field?(fully_qualified_field_name)
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
data/lib/protobuf/message.rb
CHANGED
@@ -94,7 +94,11 @@ module Protobuf
|
|
94
94
|
def field?(name)
|
95
95
|
field = self.class.get_field(name, true)
|
96
96
|
return false if field.nil?
|
97
|
-
|
97
|
+
if field.repeated?
|
98
|
+
@values.key?(field.fully_qualified_name) && @values[field.fully_qualified_name].present?
|
99
|
+
else
|
100
|
+
@values.key?(field.fully_qualified_name)
|
101
|
+
end
|
98
102
|
end
|
99
103
|
::Protobuf.deprecator.define_deprecated_methods(self, :has_field? => :field?)
|
100
104
|
|
@@ -9,6 +9,14 @@ require 'protobuf/rpc/dynamic_discovery.pb'
|
|
9
9
|
|
10
10
|
module Protobuf
|
11
11
|
module Rpc
|
12
|
+
def self.service_directory
|
13
|
+
@service_directory ||= ::Protobuf::Rpc::ServiceDirectory.instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.service_directory=(directory)
|
17
|
+
@service_directory = directory
|
18
|
+
end
|
19
|
+
|
12
20
|
class ServiceDirectory
|
13
21
|
include ::Singleton
|
14
22
|
include ::Protobuf::Logging
|
data/lib/protobuf/version.rb
CHANGED
@@ -476,6 +476,25 @@ RSpec.describe Protobuf::Message do
|
|
476
476
|
message = ::Test::Resource.new(:ext_is_searchable => false)
|
477
477
|
expect(message.ext_is_searchable!).to be(false)
|
478
478
|
end
|
479
|
+
|
480
|
+
it 'returns nil for an unset repeated field that has only be read' do
|
481
|
+
message = ::Test::Resource.new
|
482
|
+
expect(message.repeated_enum!).to be_nil
|
483
|
+
message.repeated_enum
|
484
|
+
expect(message.repeated_enum!).to be_nil
|
485
|
+
end
|
486
|
+
|
487
|
+
it 'returns value for an unset repeated field has been read and appended to' do
|
488
|
+
message = ::Test::Resource.new
|
489
|
+
message.repeated_enum << 1
|
490
|
+
expect(message.repeated_enum!).to eq([1])
|
491
|
+
end
|
492
|
+
|
493
|
+
it 'returns value for an unset repeated field has been explicitly set' do
|
494
|
+
message = ::Test::Resource.new
|
495
|
+
message.repeated_enum = [1]
|
496
|
+
expect(message.repeated_enum!).to eq([1])
|
497
|
+
end
|
479
498
|
end
|
480
499
|
end
|
481
500
|
|
@@ -562,6 +581,31 @@ RSpec.describe Protobuf::Message do
|
|
562
581
|
message = ::Test::Resource.new(ext_field => false)
|
563
582
|
expect(message.field?(100)).to be(true)
|
564
583
|
end
|
584
|
+
|
585
|
+
it 'returns false for repeated field that has been read from' do
|
586
|
+
message = ::Test::Resource.new
|
587
|
+
expect(message.field?(:repeated_enum)).to be(false)
|
588
|
+
message.repeated_enum
|
589
|
+
expect(message.field?(:repeated_enum)).to be(false)
|
590
|
+
end
|
591
|
+
|
592
|
+
it 'returns true for a repeated field that has been read from and appended to' do
|
593
|
+
message = ::Test::Resource.new
|
594
|
+
message.repeated_enum << 1
|
595
|
+
expect(message.field?(:repeated_enum)).to be(true)
|
596
|
+
end
|
597
|
+
|
598
|
+
it 'returns true for a repeated field that has been set with the setter' do
|
599
|
+
message = ::Test::Resource.new
|
600
|
+
message.repeated_enum = [1]
|
601
|
+
expect(message.field?(:repeated_enum)).to be(true)
|
602
|
+
end
|
603
|
+
|
604
|
+
it 'returns false for a repeated field that has been replaced with []' do
|
605
|
+
message = ::Test::Resource.new
|
606
|
+
message.repeated_enum.replace([])
|
607
|
+
expect(message.field?(:repeated_enum)).to be(false)
|
608
|
+
end
|
565
609
|
end
|
566
610
|
|
567
611
|
describe '.get_field' do
|
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.7.0.
|
4
|
+
version: 3.7.0.pre2
|
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: 2016-
|
14
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|