aboutsummaryrefslogtreecommitdiff
path: root/ruby/ext/google/protobuf_c/protobuf.c
Commit message (Collapse)AuthorAgeFilesLines
* Adds support for proto2 syntax for Ruby gem.Harshit Chopra2018-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | This change only adds basic proto2 support without advanced features like extensions, custom options, maps, etc. The protoc binary now generates ruby code for proto2 syntax. However, for now, it is restricted to proto2 files without advanced features like extensions, in which case it still errors out. This change also modifies the DSL to add proto messages to the DescriptorPool. There is a new DSL Builder#add_file to create a new FileDescriptor. With this, the generated ruby DSL looks something like: Google::Protobuf::DescriptorPool.generated_pool.build do add_file "test.proto" do add_message "foo" do optional :val, :int32, 1 end end end
* Adds a base class for all explicitly raised TypeErrors (#4255)Erik Benoist2018-06-261-0/+2
| | | | | | | | | * This allows for ruby code to catch and handle Protobuf TypeErrors separately from the standard Ruby TypeError * Maintains backwards compatibility by having the new Google::Protobuf::TypeError inherit from the base TypeError. Any code that was catching TypeError should continue to work.
* Add discard unknown API in ruby. (#3990)Paul Yang2017-12-071-0/+2
| | | | | | | | | | | | * Add discard unknown API in ruby. * Add test for oneof message field. * Add TestUnknown to represent unknown field data clearly. * Only serialize the message with unknown fields itself in test. * Move discard_unknown from Message to Google.Protobuf
* Fix ruby segment fault (#3708)Paul Yang2017-10-031-1/+1
| | | | | | | | | | | | | | | | * Fix ruby segment fault 1) rb_ary_new cannot be called during allocate function. During allocate fucntion, the containing object hasn't been marked and rb_ary_new may invoke gc to collect containing object. 2) The global map should be marked before allocating it. Otherwise it may be garbage collected. * Add test * Remove commented code * Fix grammer error
* Move parse frame array to the Map objectAaron Patterson2017-08-301-2/+0
| | | | This makes the frame stack per-parser, and per-thread. Fixes #3250
* Ruby: make sure map parsing frames are GC-rooted.Josh Haberman2016-08-261-0/+2
|
* Merge pull request #584 from haberman/cwarningsJoshua Haberman2015-08-211-1/+2
|\ | | | | Ruby: Conform to C89/C90 variable declaration rules.
| * Conform to C89/C90 variable declaration rules.Josh Haberman2015-07-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | While we are C99 in general, the Ruby build system for building C extensions enables several flags that throw warnings for C89/C90 variable ordering rules. To avoid spewing a million warnings (or trying to specifically override these warnings with command-line flags, which would be tricky and possibly fragile) we conform to Ruby's world of C89/C90. Change-Id: I0e03e62d95068dfdfde112df0fb16a248a2f32a0
* | Added Ruby to conformance tests.Josh Haberman2015-07-161-0/+6
|/ | | | | | | | | | | | | This involved fixing a few important bugs in the Ruby implementation -- mostly cases of mixing upb field types and descriptor types (upb field types do not distinguish between int/sint/fixed/sfixed like descriptor types do). Also added protobuf-specific exceptions so parse errors can be caught specifically. Change-Id: Ib49d3db976900b2c6f3455c8b88af52cfb86e036
* Ruby C extension speedup: don't re-intern constant string needlessly.Chris Fallin2015-05-191-0/+10
| | | | Also fixed lines with > 80 char length.
* adding and simplifying encoders/decodersAdam Greene2015-05-131-7/+0
| | | | | | * make consistent between mri and jruby * create a #to_h and have it use symbols for keys * add #to_json and #to_proto helpers on the Google::Protobuf message classes
* Support oneofs in MRI Ruby C extension.Chris Fallin2015-01-141-0/+2
|
* Support for maps in the MRI C Ruby extension.Chris Fallin2015-01-061-0/+1
| | | | | | | | This adds the Map container and support for parsing and serializing maps in the protobuf wire format (as defined by the C++ implementation, with MapEntry submessages in a repeated field). JSON map serialization/parsing are not yet supported as these will require some changes to upb as well.
* Rename protobuf Ruby module to google/protobuf and rework its buildChris Fallin2014-12-121-0/+102
system. The Ruby module build now uses an amalgamated distribution of upb, and successfully builds a Ruby gem called 'google-protobuf' with module 'google/protobuf'.