diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2016-04-15 12:57:39 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2016-04-15 12:57:39 -0700 |
commit | ca9bbd71d547a05604e8c2bddda66cdba5abe0c4 (patch) | |
tree | 4c61ab7d12d62aae7f690deefda827abeb7cb6e8 /ruby/README.md | |
parent | 814685ca2cd9280ca401e1842fd6311440921a0a (diff) | |
parent | e67ef3d449011c7923cf4c1e4b205ebd0d6f2167 (diff) | |
download | protobuf-ca9bbd71d547a05604e8c2bddda66cdba5abe0c4.tar.gz protobuf-ca9bbd71d547a05604e8c2bddda66cdba5abe0c4.tar.bz2 protobuf-ca9bbd71d547a05604e8c2bddda66cdba5abe0c4.zip |
Merge pull request #1413 from haberman/updateupb
Updated upb: JSON parser now accepts both camelCase and original case, and flag to choose on output.
Diffstat (limited to 'ruby/README.md')
-rw-r--r-- | ruby/README.md | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/ruby/README.md b/ruby/README.md index 16474322..f28e05a7 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -32,23 +32,25 @@ documentation may be found in the RubyDoc comments (`call-seq` tags) in the source, and we plan to release separate, more detailed, documentation at a later date. - require 'google/protobuf' +```ruby +require 'google/protobuf' - # generated from my_proto_types.proto with protoc: - # $ protoc --ruby_out=. my_proto_types.proto - require 'my_proto_types' +# generated from my_proto_types.proto with protoc: +# $ protoc --ruby_out=. my_proto_types.proto +require 'my_proto_types' - mymessage = MyTestMessage.new(:field1 => 42, :field2 => ["a", "b", "c"]) - mymessage.field1 = 43 - mymessage.field2.push("d") - mymessage.field3 = SubMessage.new(:foo => 100) +mymessage = MyTestMessage.new(:field1 => 42, :field2 => ["a", "b", "c"]) +mymessage.field1 = 43 +mymessage.field2.push("d") +mymessage.field3 = SubMessage.new(:foo => 100) - encoded_data = MyTestMessage.encode(mymessage) - decoded = MyTestMessage.decode(encoded_data) - assert decoded == mymessage +encoded_data = MyTestMessage.encode(mymessage) +decoded = MyTestMessage.decode(encoded_data) +assert decoded == mymessage - puts "JSON:" - puts MyTestMessage.encode_json(mymessage) +puts "JSON:" +puts MyTestMessage.encode_json(mymessage) +``` Installation from Source (Building Gem) --------------------------------------- |