protobuf_nested_struct 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: bae6c6d57359ec2a06c717c132da705bec0f569e
4
- data.tar.gz: 0d11b7bc9dc5ef4a4a10808c33bfc56ba7405e91
3
+ metadata.gz: 325c42625e181ee9fc01b781e195eb92b576bdf3
4
+ data.tar.gz: 2504b35d39646c90c2c310ac7d5b8385d4e5b324
5
5
  SHA512:
6
- metadata.gz: 9d506d70254b800a612076f2f5bfd12b12980bd58f479963fe51315e321b1e6e31177a372fe358ea291339900b85f8147f5dc76d46eb75e5bcf9141b9f4eabaf
7
- data.tar.gz: 817930eb2167b5d9f37c1e205b59292cc18b199383ecd0006aa1135ac064b56db27229fec5c33ca8264931ed86b813cf0ae3bc18b1301d8279a4e6327a54f7fb
6
+ metadata.gz: c5cb570490b92e8ffc96218ef2c1bd0571f165c78553d532d40e67ad8df8e46363a25fdfe7d6173f32b6aa969c21f0cf403d47052c2ede1ce7e16c5986871c0e
7
+ data.tar.gz: f0541625ee9f82acb846e1c049cbf66f5a93dbca9b5e0b961ebe513787b9ec483e07ad70a34bdf77ff8fa6d95cef50ba0930a181f11ac632baed99aafdd62454
@@ -1,7 +1,10 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.1
5
- - 2.4.3
6
- - 2.3.7
4
+ - 2.5.1
5
+ - 2.4.3
6
+ - 2.3.7
7
7
  before_install: gem install bundler -v 1.16.1
8
+ notifications:
9
+ slack:
10
+ secure: no8/ZtMrQm8EyglLJW9toPdKGwa7g1+AcWwlnzH7HCAp9dSafETt5HOIxzIecotVFV+VCoHi1lrHnJoyJ8svOfro9Jh1i1+oZzW+eHH/Df4AVyPOPLlJINoLi/SP+d7NTgS4+oVYB/y7uPC9y7QkdaTxGC540OaXmbVbw7M/GSMv7n6qVOmdMnH/JeH9qjHkJ3FUmnnWY2AVlUrcpERIOcdB4zN65b+7zMUUGqAXnbpTOrYC0S5q0yr0omBfmEnkbgpyN4m9QZE07ILky0RHayA7/HuyAPi9D8u36G6yWbi18QxJpH2Y4KRNlFrNKg+JYMbvTTtjpy6W8NoWq8XK38UBi+oc2Vg9p1rRTndqrUALCyWunuNpsBoMebcNajV8EbTftsSqjcoV+KE/jc1zHa5RlcFs07pI3khrOnCyoAoxSgCv53wZeboXRlo/yeB1kML97us+AkcAAf+RRNwQvUbV+BGejwIOwplG41+GqvjfpcLb8achieDdbSzzVTKX0gPWqBkKgiNzHV7c84oWARFOJPqm1TosnEAQ13VKa4n5RWeL4tk1rT3t5S4Cl0ZlN/nasGHKbt5s9iTyT4xrxtbSp2aMKWtyZNUZF0wpfzZoVl5I7OGmiHT2Z/pRb158HG+dqB4SvSqJrFAG/+6d8xJdm982vRfl+p0CtVIV3Qk=
data/README.md CHANGED
@@ -47,6 +47,13 @@ expect(copy).to eql(obj)
47
47
 
48
48
  where `obj` can be an instance of one of the supported types.
49
49
 
50
+ ## Protobuf schema definition
51
+
52
+ You can use it to generate code for serialization and deserialization in any programming language supported
53
+ by Protobuf.
54
+
55
+ * https://github.com/arkency/protobuf-nested-struct/blob/master/lib/protobuf_nested_struct/struct.proto
56
+
50
57
  ## Development
51
58
 
52
59
  * `bundle install`
@@ -7,6 +7,17 @@ require 'protobuf_nested_struct/struct_pb'
7
7
 
8
8
  module ProtobufNestedStruct
9
9
  class Value
10
+ def self.dump(obj)
11
+ v = new
12
+ v.from_ruby(obj)
13
+ encode(v)
14
+ end
15
+
16
+ def self.load(string)
17
+ v = decode(string)
18
+ v.to_ruby
19
+ end
20
+
10
21
  def from_ruby(obj)
11
22
  case obj
12
23
  when nil
@@ -60,6 +71,17 @@ module ProtobufNestedStruct
60
71
  end
61
72
 
62
73
  class HashMapStringValue
74
+ def self.dump(obj)
75
+ v = new
76
+ v.from_ruby(obj)
77
+ encode(v)
78
+ end
79
+
80
+ def self.load(string)
81
+ v = decode(string)
82
+ v.to_ruby
83
+ end
84
+
63
85
  def from_ruby(obj)
64
86
  Hash === obj or raise ArgumentError
65
87
  obj.each do |key, value|
@@ -76,6 +98,17 @@ module ProtobufNestedStruct
76
98
  end
77
99
 
78
100
  class ListValue
101
+ def self.dump(obj)
102
+ v = new
103
+ v.from_ruby(obj)
104
+ encode(v)
105
+ end
106
+
107
+ def self.load(string)
108
+ v = decode(string)
109
+ v.to_ruby
110
+ end
111
+
79
112
  def from_ruby(obj)
80
113
  Array === obj or raise ArgumentError
81
114
  values.clear
@@ -90,13 +123,10 @@ module ProtobufNestedStruct
90
123
  end
91
124
 
92
125
  def self.dump(obj)
93
- v = Value.new
94
- v.from_ruby(obj)
95
- Value.encode(v)
126
+ Value.dump(obj)
96
127
  end
97
128
 
98
129
  def self.load(string)
99
- v = Value.decode(string)
100
- v.to_ruby
130
+ Value.load(string)
101
131
  end
102
132
  end
@@ -1,3 +1,3 @@
1
1
  module ProtobufNestedStruct
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf_nested_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Pankowecki
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-04-19 00:00:00.000000000 Z
12
+ date: 2018-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-protobuf