aboutsummaryrefslogtreecommitdiff
path: root/ruby/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/README.md')
-rw-r--r--ruby/README.md32
1 files changed, 15 insertions, 17 deletions
diff --git a/ruby/README.md b/ruby/README.md
index 16474322..78e86015 100644
--- a/ruby/README.md
+++ b/ruby/README.md
@@ -16,10 +16,6 @@ install it as you would any other gem:
$ gem install [--prerelease] google-protobuf
-The `--pre` flag is necessary if we have not yet made a non-alpha/beta release
-of the Ruby extension; it allows `gem` to consider these "pre-release"
-alpha/beta versions.
-
Once the gem is installed, you may or may not need `protoc`. If you write your
message type descriptions directly in the Ruby DSL, you do not need it.
However, if you wish to generate the Ruby DSL from a `.proto` file, you will
@@ -32,23 +28,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)
---------------------------------------