+14
-0
lines changedFilter options
+14
-0
lines changed Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ def to_proto(options = {})
25
25
self.class.encode(self, options)
26
26
end
27
27
28
+
def to_hash
29
+
self.to_h
30
+
end
31
+
28
32
end
29
33
class AbstractMessage
30
34
include MessageExts
Original file line number Diff line number Diff line change
@@ -496,6 +496,16 @@ def test_to_h
496
496
assert_equal expected_result, m.to_h
497
497
end
498
498
499
+
def test_to_hash
500
+
m = TestMessage.new(
501
+
:optional_bool => true,
502
+
:optional_double => -10.100001,
503
+
:optional_string => 'foo',
504
+
:repeated_string => ['bar1', 'bar2'],
505
+
:repeated_msg => [TestMessage2.new(:foo => 100)]
506
+
)
507
+
assert_equal m.to_hash, m.to_h
508
+
end
499
509
500
510
def test_json_maps
501
511
m = MapMessage.new(:map_string_int32 => {"a" => 1})
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4