aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/lib/google/protobuf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/lib/google/protobuf.rb')
-rw-r--r--ruby/lib/google/protobuf.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/ruby/lib/google/protobuf.rb b/ruby/lib/google/protobuf.rb
index 72797245..99b17929 100644
--- a/ruby/lib/google/protobuf.rb
+++ b/ruby/lib/google/protobuf.rb
@@ -28,6 +28,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# require mixins before we hook them into the java & c code
+require 'google/protobuf/message_exts'
+
if RUBY_PLATFORM == "java"
require 'json'
require 'google/protobuf_java'
@@ -36,3 +39,25 @@ else
end
require 'google/protobuf/repeated_field'
+
+module Google
+ module Protobuf
+
+ def self.encode(msg)
+ msg.to_proto
+ end
+
+ def self.encode_json(msg)
+ msg.to_json
+ end
+
+ def self.decode(klass, proto)
+ klass.decode(proto)
+ end
+
+ def self.decode_json(klass, json)
+ klass.decode_json(json)
+ end
+
+ end
+end