protip 0.37 → 0.37.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protip/decorator.rb +8 -3
- data/lib/protip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236eb63af48bf81e28875f5dcdef16158ba69db7785436f47013481bab29fd51
|
4
|
+
data.tar.gz: 948cede4acce33d7da2e13af36da7f51d35cd073327ca6d666759004afd15140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833843e0287ad841903526db31eb40daef4dfaa389b23ab7dd34643bdc508c5696ee2f58f8a2a51697558008f1205e0a0180361129a090f6adf34d7d54a14787
|
7
|
+
data.tar.gz: b799bb1e32e81541ffe1a90e3a64721df338ee5fe8e315bfbab83486e4e1212866705af804bfd55308d0f39a9e11d07e54fd0613c9de1dc933e34bbb82463196
|
data/lib/protip/decorator.rb
CHANGED
@@ -228,9 +228,14 @@ module Protip
|
|
228
228
|
def set(field, value)
|
229
229
|
return if field.label == :optional && value.nil? && get(field).nil?
|
230
230
|
|
231
|
-
|
231
|
+
if field.label == :repeated
|
232
|
+
new_values = value.map {|v| to_protobuf_value(field, v) }.compact
|
233
|
+
|
234
|
+
message[field.name].replace(new_values)
|
235
|
+
else
|
236
|
+
message[field.name] = to_protobuf_value(field, value)
|
237
|
+
end
|
232
238
|
|
233
|
-
message[field.name] = to_protobuf_value(field, value)
|
234
239
|
end
|
235
240
|
|
236
241
|
# Helper for setting values - converts the value for the given
|
@@ -238,7 +243,7 @@ module Protip
|
|
238
243
|
def to_protobuf_value(field, value)
|
239
244
|
if field.type == :message
|
240
245
|
if nil == value
|
241
|
-
|
246
|
+
field&.default || field&.subtype&.msgclass&.new
|
242
247
|
# This check must happen before the nested_resources check to
|
243
248
|
# ensure nested messages are set properly
|
244
249
|
elsif value.is_a?(field.subtype.msgclass)
|
data/lib/protip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.37.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AngelList
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|