aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorYilun Chong <yilunchong@google.com>2017-06-27 18:24:15 -0700
committerYilun Chong <yilunchong@google.com>2017-06-27 18:24:15 -0700
commit18a0c2c4d2894e820f96494f33d8ca3ea33dec3a (patch)
treeba6297a500f23a17ba2844f3daeae0f02561ac80 /ruby
parent2ad74e1606728564cc777aa4917d7e2299317eda (diff)
downloadprotobuf-18a0c2c4d2894e820f96494f33d8ca3ea33dec3a.tar.gz
protobuf-18a0c2c4d2894e820f96494f33d8ca3ea33dec3a.tar.bz2
protobuf-18a0c2c4d2894e820f96494f33d8ca3ea33dec3a.zip
add proto2 supported for cpp,python,nodejs,ruby,php
Diffstat (limited to 'ruby')
-rw-r--r--ruby/lib/google/protobuf/any_pb.rb17
-rw-r--r--ruby/lib/google/protobuf/api_pb.rb39
-rw-r--r--ruby/lib/google/protobuf/duration_pb.rb17
-rw-r--r--ruby/lib/google/protobuf/empty_pb.rb15
-rw-r--r--ruby/lib/google/protobuf/field_mask_pb.rb16
-rw-r--r--ruby/lib/google/protobuf/source_context_pb.rb16
-rw-r--r--ruby/lib/google/protobuf/struct_pb.rb35
-rw-r--r--ruby/lib/google/protobuf/timestamp_pb.rb17
-rw-r--r--ruby/lib/google/protobuf/type_pb.rb89
-rw-r--r--ruby/lib/google/protobuf/wrappers_pb.rb48
-rw-r--r--ruby/tests/generated_code_pb.rb74
-rw-r--r--ruby/tests/test_import_pb.rb13
12 files changed, 396 insertions, 0 deletions
diff --git a/ruby/lib/google/protobuf/any_pb.rb b/ruby/lib/google/protobuf/any_pb.rb
new file mode 100644
index 00000000..88d2c12b
--- /dev/null
+++ b/ruby/lib/google/protobuf/any_pb.rb
@@ -0,0 +1,17 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/any.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Any" do
+ optional :type_url, :string, 1
+ optional :value, :bytes, 2
+ end
+end
+
+module Google
+ module Protobuf
+ Any = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Any").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/api_pb.rb b/ruby/lib/google/protobuf/api_pb.rb
new file mode 100644
index 00000000..1676b587
--- /dev/null
+++ b/ruby/lib/google/protobuf/api_pb.rb
@@ -0,0 +1,39 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/api.proto
+
+require 'google/protobuf'
+
+require 'google/protobuf/source_context_pb'
+require 'google/protobuf/type_pb'
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Api" do
+ optional :name, :string, 1
+ repeated :methods, :message, 2, "google.protobuf.Method"
+ repeated :options, :message, 3, "google.protobuf.Option"
+ optional :version, :string, 4
+ optional :source_context, :message, 5, "google.protobuf.SourceContext"
+ repeated :mixins, :message, 6, "google.protobuf.Mixin"
+ optional :syntax, :enum, 7, "google.protobuf.Syntax"
+ end
+ add_message "google.protobuf.Method" do
+ optional :name, :string, 1
+ optional :request_type_url, :string, 2
+ optional :request_streaming, :bool, 3
+ optional :response_type_url, :string, 4
+ optional :response_streaming, :bool, 5
+ repeated :options, :message, 6, "google.protobuf.Option"
+ optional :syntax, :enum, 7, "google.protobuf.Syntax"
+ end
+ add_message "google.protobuf.Mixin" do
+ optional :name, :string, 1
+ optional :root, :string, 2
+ end
+end
+
+module Google
+ module Protobuf
+ Api = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Api").msgclass
+ Method = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Method").msgclass
+ Mixin = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Mixin").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/duration_pb.rb b/ruby/lib/google/protobuf/duration_pb.rb
new file mode 100644
index 00000000..c93f5987
--- /dev/null
+++ b/ruby/lib/google/protobuf/duration_pb.rb
@@ -0,0 +1,17 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/duration.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Duration" do
+ optional :seconds, :int64, 1
+ optional :nanos, :int32, 2
+ end
+end
+
+module Google
+ module Protobuf
+ Duration = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Duration").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/empty_pb.rb b/ruby/lib/google/protobuf/empty_pb.rb
new file mode 100644
index 00000000..580db6dd
--- /dev/null
+++ b/ruby/lib/google/protobuf/empty_pb.rb
@@ -0,0 +1,15 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/empty.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Empty" do
+ end
+end
+
+module Google
+ module Protobuf
+ Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/field_mask_pb.rb b/ruby/lib/google/protobuf/field_mask_pb.rb
new file mode 100644
index 00000000..ea2811ab
--- /dev/null
+++ b/ruby/lib/google/protobuf/field_mask_pb.rb
@@ -0,0 +1,16 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/field_mask.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.FieldMask" do
+ repeated :paths, :string, 1
+ end
+end
+
+module Google
+ module Protobuf
+ FieldMask = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldMask").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/source_context_pb.rb b/ruby/lib/google/protobuf/source_context_pb.rb
new file mode 100644
index 00000000..d099d0ea
--- /dev/null
+++ b/ruby/lib/google/protobuf/source_context_pb.rb
@@ -0,0 +1,16 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/source_context.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.SourceContext" do
+ optional :file_name, :string, 1
+ end
+end
+
+module Google
+ module Protobuf
+ SourceContext = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceContext").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/struct_pb.rb b/ruby/lib/google/protobuf/struct_pb.rb
new file mode 100644
index 00000000..af53c6e1
--- /dev/null
+++ b/ruby/lib/google/protobuf/struct_pb.rb
@@ -0,0 +1,35 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/struct.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Struct" do
+ map :fields, :string, :message, 1, "google.protobuf.Value"
+ end
+ add_message "google.protobuf.Value" do
+ oneof :kind do
+ optional :null_value, :enum, 1, "google.protobuf.NullValue"
+ optional :number_value, :double, 2
+ optional :string_value, :string, 3
+ optional :bool_value, :bool, 4
+ optional :struct_value, :message, 5, "google.protobuf.Struct"
+ optional :list_value, :message, 6, "google.protobuf.ListValue"
+ end
+ end
+ add_message "google.protobuf.ListValue" do
+ repeated :values, :message, 1, "google.protobuf.Value"
+ end
+ add_enum "google.protobuf.NullValue" do
+ value :NULL_VALUE, 0
+ end
+end
+
+module Google
+ module Protobuf
+ Struct = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Struct").msgclass
+ Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Value").msgclass
+ ListValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ListValue").msgclass
+ NullValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.NullValue").enummodule
+ end
+end
diff --git a/ruby/lib/google/protobuf/timestamp_pb.rb b/ruby/lib/google/protobuf/timestamp_pb.rb
new file mode 100644
index 00000000..7af33339
--- /dev/null
+++ b/ruby/lib/google/protobuf/timestamp_pb.rb
@@ -0,0 +1,17 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/timestamp.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Timestamp" do
+ optional :seconds, :int64, 1
+ optional :nanos, :int32, 2
+ end
+end
+
+module Google
+ module Protobuf
+ Timestamp = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Timestamp").msgclass
+ end
+end
diff --git a/ruby/lib/google/protobuf/type_pb.rb b/ruby/lib/google/protobuf/type_pb.rb
new file mode 100644
index 00000000..ffcbb9de
--- /dev/null
+++ b/ruby/lib/google/protobuf/type_pb.rb
@@ -0,0 +1,89 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/type.proto
+
+require 'google/protobuf'
+
+require 'google/protobuf/any_pb'
+require 'google/protobuf/source_context_pb'
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.Type" do
+ optional :name, :string, 1
+ repeated :fields, :message, 2, "google.protobuf.Field"
+ repeated :oneofs, :string, 3
+ repeated :options, :message, 4, "google.protobuf.Option"
+ optional :source_context, :message, 5, "google.protobuf.SourceContext"
+ optional :syntax, :enum, 6, "google.protobuf.Syntax"
+ end
+ add_message "google.protobuf.Field" do
+ optional :kind, :enum, 1, "google.protobuf.Field.Kind"
+ optional :cardinality, :enum, 2, "google.protobuf.Field.Cardinality"
+ optional :number, :int32, 3
+ optional :name, :string, 4
+ optional :type_url, :string, 6
+ optional :oneof_index, :int32, 7
+ optional :packed, :bool, 8
+ repeated :options, :message, 9, "google.protobuf.Option"
+ optional :json_name, :string, 10
+ optional :default_value, :string, 11
+ end
+ add_enum "google.protobuf.Field.Kind" do
+ value :TYPE_UNKNOWN, 0
+ value :TYPE_DOUBLE, 1
+ value :TYPE_FLOAT, 2
+ value :TYPE_INT64, 3
+ value :TYPE_UINT64, 4
+ value :TYPE_INT32, 5
+ value :TYPE_FIXED64, 6
+ value :TYPE_FIXED32, 7
+ value :TYPE_BOOL, 8
+ value :TYPE_STRING, 9
+ value :TYPE_GROUP, 10
+ value :TYPE_MESSAGE, 11
+ value :TYPE_BYTES, 12
+ value :TYPE_UINT32, 13
+ value :TYPE_ENUM, 14
+ value :TYPE_SFIXED32, 15
+ value :TYPE_SFIXED64, 16
+ value :TYPE_SINT32, 17
+ value :TYPE_SINT64, 18
+ end
+ add_enum "google.protobuf.Field.Cardinality" do
+ value :CARDINALITY_UNKNOWN, 0
+ value :CARDINALITY_OPTIONAL, 1
+ value :CARDINALITY_REQUIRED, 2
+ value :CARDINALITY_REPEATED, 3
+ end
+ add_message "google.protobuf.Enum" do
+ optional :name, :string, 1
+ repeated :enumvalue, :message, 2, "google.protobuf.EnumValue"
+ repeated :options, :message, 3, "google.protobuf.Option"
+ optional :source_context, :message, 4, "google.protobuf.SourceContext"
+ optional :syntax, :enum, 5, "google.protobuf.Syntax"
+ end
+ add_message "google.protobuf.EnumValue" do
+ optional :name, :string, 1
+ optional :number, :int32, 2
+ repeated :options, :message, 3, "google.protobuf.Option"
+ end
+ add_message "google.protobuf.Option" do
+ optional :name, :string, 1
+ optional :value, :message, 2, "google.protobuf.Any"
+ end
+ add_enum "google.protobuf.Syntax" do
+ value :SYNTAX_PROTO2, 0
+ value :SYNTAX_PROTO3, 1
+ end
+end
+
+module Google
+ module Protobuf
+ Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Type").msgclass
+ Field = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field").msgclass
+ Field::Kind = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Kind").enummodule
+ Field::Cardinality = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Cardinality").enummodule
+ Enum = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Enum").msgclass
+ EnumValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValue").msgclass
+ Option = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Option").msgclass
+ Syntax = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Syntax").enummodule
+ end
+end
diff --git a/ruby/lib/google/protobuf/wrappers_pb.rb b/ruby/lib/google/protobuf/wrappers_pb.rb
new file mode 100644
index 00000000..e26a4d23
--- /dev/null
+++ b/ruby/lib/google/protobuf/wrappers_pb.rb
@@ -0,0 +1,48 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/wrappers.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "google.protobuf.DoubleValue" do
+ optional :value, :double, 1
+ end
+ add_message "google.protobuf.FloatValue" do
+ optional :value, :float, 1
+ end
+ add_message "google.protobuf.Int64Value" do
+ optional :value, :int64, 1
+ end
+ add_message "google.protobuf.UInt64Value" do
+ optional :value, :uint64, 1
+ end
+ add_message "google.protobuf.Int32Value" do
+ optional :value, :int32, 1
+ end
+ add_message "google.protobuf.UInt32Value" do
+ optional :value, :uint32, 1
+ end
+ add_message "google.protobuf.BoolValue" do
+ optional :value, :bool, 1
+ end
+ add_message "google.protobuf.StringValue" do
+ optional :value, :string, 1
+ end
+ add_message "google.protobuf.BytesValue" do
+ optional :value, :bytes, 1
+ end
+end
+
+module Google
+ module Protobuf
+ DoubleValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DoubleValue").msgclass
+ FloatValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FloatValue").msgclass
+ Int64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int64Value").msgclass
+ UInt64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt64Value").msgclass
+ Int32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int32Value").msgclass
+ UInt32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt32Value").msgclass
+ BoolValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BoolValue").msgclass
+ StringValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.StringValue").msgclass
+ BytesValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BytesValue").msgclass
+ end
+end
diff --git a/ruby/tests/generated_code_pb.rb b/ruby/tests/generated_code_pb.rb
new file mode 100644
index 00000000..0358ada7
--- /dev/null
+++ b/ruby/tests/generated_code_pb.rb
@@ -0,0 +1,74 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: tests/generated_code.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "a.b.c.TestMessage" do
+ optional :optional_int32, :int32, 1
+ optional :optional_int64, :int64, 2
+ optional :optional_uint32, :uint32, 3
+ optional :optional_uint64, :uint64, 4
+ optional :optional_bool, :bool, 5
+ optional :optional_double, :double, 6
+ optional :optional_float, :float, 7
+ optional :optional_string, :string, 8
+ optional :optional_bytes, :bytes, 9
+ optional :optional_enum, :enum, 10, "a.b.c.TestEnum"
+ optional :optional_msg, :message, 11, "a.b.c.TestMessage"
+ repeated :repeated_int32, :int32, 21
+ repeated :repeated_int64, :int64, 22
+ repeated :repeated_uint32, :uint32, 23
+ repeated :repeated_uint64, :uint64, 24
+ repeated :repeated_bool, :bool, 25
+ repeated :repeated_double, :double, 26
+ repeated :repeated_float, :float, 27
+ repeated :repeated_string, :string, 28
+ repeated :repeated_bytes, :bytes, 29
+ repeated :repeated_enum, :enum, 30, "a.b.c.TestEnum"
+ repeated :repeated_msg, :message, 31, "a.b.c.TestMessage"
+ map :map_int32_string, :int32, :string, 61
+ map :map_int64_string, :int64, :string, 62
+ map :map_uint32_string, :uint32, :string, 63
+ map :map_uint64_string, :uint64, :string, 64
+ map :map_bool_string, :bool, :string, 65
+ map :map_string_string, :string, :string, 66
+ map :map_string_msg, :string, :message, 67, "a.b.c.TestMessage"
+ map :map_string_enum, :string, :enum, 68, "a.b.c.TestEnum"
+ map :map_string_int32, :string, :int32, 69
+ map :map_string_bool, :string, :bool, 70
+ optional :nested_message, :message, 80, "a.b.c.TestMessage.NestedMessage"
+ oneof :my_oneof do
+ optional :oneof_int32, :int32, 41
+ optional :oneof_int64, :int64, 42
+ optional :oneof_uint32, :uint32, 43
+ optional :oneof_uint64, :uint64, 44
+ optional :oneof_bool, :bool, 45
+ optional :oneof_double, :double, 46
+ optional :oneof_float, :float, 47
+ optional :oneof_string, :string, 48
+ optional :oneof_bytes, :bytes, 49
+ optional :oneof_enum, :enum, 50, "a.b.c.TestEnum"
+ optional :oneof_msg, :message, 51, "a.b.c.TestMessage"
+ end
+ end
+ add_message "a.b.c.TestMessage.NestedMessage" do
+ optional :foo, :int32, 1
+ end
+ add_enum "a.b.c.TestEnum" do
+ value :Default, 0
+ value :A, 1
+ value :B, 2
+ value :C, 3
+ end
+end
+
+module A
+ module B
+ module C
+ TestMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestMessage").msgclass
+ TestMessage::NestedMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestMessage.NestedMessage").msgclass
+ TestEnum = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestEnum").enummodule
+ end
+ end
+end
diff --git a/ruby/tests/test_import_pb.rb b/ruby/tests/test_import_pb.rb
new file mode 100644
index 00000000..83f04d60
--- /dev/null
+++ b/ruby/tests/test_import_pb.rb
@@ -0,0 +1,13 @@
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: tests/test_import.proto
+
+require 'google/protobuf'
+
+Google::Protobuf::DescriptorPool.generated_pool.build do
+ add_message "foo_bar.TestImportedMessage" do
+ end
+end
+
+module FooBar
+ TestImportedMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("foo_bar.TestImportedMessage").msgclass
+end