Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/protobuf/ruby/lib/google/protobuf.rb

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Protocol Buffers - Google's data interchange format 1 # Protocol Buffers - Google's data interchange format
2 # Copyright 2008 Google Inc. All rights reserved. 2 # Copyright 2008 Google Inc. All rights reserved.
3 # https://developers.google.com/protocol-buffers/ 3 # https://developers.google.com/protocol-buffers/
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 26 matching lines...) Expand all
37 module Protobuf 37 module Protobuf
38 class Error < StandardError; end 38 class Error < StandardError; end
39 class ParseError < Error; end 39 class ParseError < Error; end
40 end 40 end
41 end 41 end
42 42
43 if RUBY_PLATFORM == "java" 43 if RUBY_PLATFORM == "java"
44 require 'json' 44 require 'json'
45 require 'google/protobuf_java' 45 require 'google/protobuf_java'
46 else 46 else
47 require 'google/protobuf_c' 47 begin
48 require "google/#{RUBY_VERSION.sub(/\.\d$/, '')}/protobuf_c"
49 rescue LoadError
50 require 'google/protobuf_c'
51 end
48 end 52 end
49 53
50 require 'google/protobuf/repeated_field' 54 require 'google/protobuf/repeated_field'
51 55
52 module Google 56 module Google
53 module Protobuf 57 module Protobuf
54 58
55 def self.encode(msg) 59 def self.encode(msg)
56 msg.to_proto 60 msg.to_proto
57 end 61 end
58 62
59 def self.encode_json(msg) 63 def self.encode_json(msg)
60 msg.to_json 64 msg.to_json
61 end 65 end
62 66
63 def self.decode(klass, proto) 67 def self.decode(klass, proto)
64 klass.decode(proto) 68 klass.decode(proto)
65 end 69 end
66 70
67 def self.decode_json(klass, json) 71 def self.decode_json(klass, json)
68 klass.decode_json(json) 72 klass.decode_json(json)
69 end 73 end
70 74
71 end 75 end
72 end 76 end
OLDNEW
« no previous file with comments | « third_party/protobuf/ruby/google-protobuf.gemspec ('k') | third_party/protobuf/ruby/lib/google/protobuf/repeated_field.rb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698