google-protobuf 4.31.1-x86_64-linux-musl → 4.32.0.rc.1-x86_64-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,17 +28,11 @@ else
28
28
  $CFLAGS += " -std=gnu99 #{additional_c_flags}"
29
29
  end
30
30
 
31
- if RUBY_PLATFORM =~ /linux/
32
- # Instruct the linker to point memcpy calls at our __wrap_memcpy wrapper.
33
- $LDFLAGS += " -Wl,-wrap,memcpy"
34
- end
35
-
36
31
  $VPATH << "$(srcdir)/third_party/utf8_range"
37
32
  $INCFLAGS += " -I$(srcdir)/third_party/utf8_range"
38
33
 
39
- $srcs = ["protobuf.c", "convert.c", "defs.c", "message.c",
40
- "repeated_field.c", "map.c", "ruby-upb.c", "wrap_memcpy.c",
41
- "utf8_range.c", "shared_convert.c",
34
+ $srcs = ["protobuf.c", "convert.c", "defs.c", "message.c", "repeated_field.c",
35
+ "map.c", "ruby-upb.c", "utf8_range.c", "shared_convert.c",
42
36
  "shared_message.c"]
43
37
 
44
38
  create_makefile(ext_name)
@@ -236,10 +236,15 @@ static VALUE Map_merge_into_self(VALUE _self, VALUE hashmap) {
236
236
  return _self;
237
237
  }
238
238
 
239
+ /**
240
+ * ruby-doc: Map
241
+ *
242
+ * This class represents a Protobuf Map. It is largely automatically transformed
243
+ * to and from a Ruby hash.
244
+ */
245
+
239
246
  /*
240
- * call-seq:
241
- * Map.new(key_type, value_type, value_typeclass = nil, init_hashmap = {})
242
- * => new map
247
+ * ruby-doc: Map#initialize
243
248
  *
244
249
  * Allocates a new Map container. This constructor may be called with 2, 3, or 4
245
250
  * arguments. The first two arguments are always present and are symbols (taking
@@ -265,6 +270,13 @@ static VALUE Map_merge_into_self(VALUE _self, VALUE hashmap) {
265
270
  * shallow-copied into the new Map: the original map is unmodified, but
266
271
  * references to underlying objects will be shared if the value type is a
267
272
  * message type.
273
+ *
274
+ * @param key_type [Symbol]
275
+ * @param value_type [Symbol]
276
+ * @param value_typeclass [Class<AbstractMessage>,Module]
277
+ * @paramdefault value_typeclass nil
278
+ * @param init_hashmap [Hash,Map]
279
+ * @paramdefault init_hashmap {}
268
280
  */
269
281
  static VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
270
282
  Map* self = ruby_to_Map(_self);
@@ -311,12 +323,14 @@ static VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
311
323
  }
312
324
 
313
325
  /*
314
- * call-seq:
315
- * Map.each(&block)
326
+ * ruby-doc: Map#each
316
327
  *
317
328
  * Invokes &block on each |key, value| pair in the map, in unspecified order.
318
329
  * Note that Map also includes Enumerable; map thus acts like a normal Ruby
319
330
  * sequence.
331
+ *
332
+ * @yield [Object, Object]
333
+ * @return [nil]
320
334
  */
321
335
  static VALUE Map_each(VALUE _self) {
322
336
  Map* self = ruby_to_Map(_self);
@@ -333,10 +347,11 @@ static VALUE Map_each(VALUE _self) {
333
347
  }
334
348
 
335
349
  /*
336
- * call-seq:
337
- * Map.keys => [list_of_keys]
350
+ * ruby-doc: Map#keys
338
351
  *
339
352
  * Returns the list of keys contained in the map, in unspecified order.
353
+ *
354
+ * @return [Array<Object>]
340
355
  */
341
356
  static VALUE Map_keys(VALUE _self) {
342
357
  Map* self = ruby_to_Map(_self);
@@ -353,10 +368,11 @@ static VALUE Map_keys(VALUE _self) {
353
368
  }
354
369
 
355
370
  /*
356
- * call-seq:
357
- * Map.values => [list_of_values]
371
+ * ruby-doc: Map#values
358
372
  *
359
373
  * Returns the list of values contained in the map, in unspecified order.
374
+ *
375
+ * @return [Array<Object>]
360
376
  */
361
377
  static VALUE Map_values(VALUE _self) {
362
378
  Map* self = ruby_to_Map(_self);
@@ -373,11 +389,13 @@ static VALUE Map_values(VALUE _self) {
373
389
  }
374
390
 
375
391
  /*
376
- * call-seq:
377
- * Map.[](key) => value
392
+ * ruby-doc: Map#[]
378
393
  *
379
394
  * Accesses the element at the given key. Throws an exception if the key type is
380
395
  * incorrect. Returns nil when the key is not present in the map.
396
+ *
397
+ * @param key [Object]
398
+ * @return [Object]
381
399
  */
382
400
  static VALUE Map_index(VALUE _self, VALUE key) {
383
401
  Map* self = ruby_to_Map(_self);
@@ -393,12 +411,15 @@ static VALUE Map_index(VALUE _self, VALUE key) {
393
411
  }
394
412
 
395
413
  /*
396
- * call-seq:
397
- * Map.[]=(key, value) => value
414
+ * ruby-doc: Map#[]=
398
415
  *
399
416
  * Inserts or overwrites the value at the given key with the given new value.
400
417
  * Throws an exception if the key type is incorrect. Returns the new value that
401
418
  * was just inserted.
419
+ *
420
+ * @param key [Object]
421
+ * @param value [Object]
422
+ * @return [Object]
402
423
  */
403
424
  static VALUE Map_index_set(VALUE _self, VALUE key, VALUE val) {
404
425
  Map* self = ruby_to_Map(_self);
@@ -414,11 +435,13 @@ static VALUE Map_index_set(VALUE _self, VALUE key, VALUE val) {
414
435
  }
415
436
 
416
437
  /*
417
- * call-seq:
418
- * Map.has_key?(key) => bool
438
+ * ruby-doc: Map#has_key?
419
439
  *
420
440
  * Returns true if the given key is present in the map. Throws an exception if
421
441
  * the key has the wrong type.
442
+ *
443
+ * @param key [Object]
444
+ * @return [Boolean]
422
445
  */
423
446
  static VALUE Map_has_key(VALUE _self, VALUE key) {
424
447
  Map* self = ruby_to_Map(_self);
@@ -433,11 +456,13 @@ static VALUE Map_has_key(VALUE _self, VALUE key) {
433
456
  }
434
457
 
435
458
  /*
436
- * call-seq:
437
- * Map.delete(key) => old_value
459
+ * ruby-doc: Map#delete
438
460
  *
439
461
  * Deletes the value at the given key, if any, returning either the old value or
440
462
  * nil if none was present. Throws an exception if the key is of the wrong type.
463
+ *
464
+ * @param key [Object]
465
+ * @return [Object]
441
466
  */
442
467
  static VALUE Map_delete(VALUE _self, VALUE key) {
443
468
  upb_Map* map = Map_GetMutable(_self);
@@ -455,10 +480,11 @@ static VALUE Map_delete(VALUE _self, VALUE key) {
455
480
  }
456
481
 
457
482
  /*
458
- * call-seq:
459
- * Map.clear
483
+ * ruby-doc: Map#clear
460
484
  *
461
485
  * Removes all entries from the map.
486
+ *
487
+ * @return [nil]
462
488
  */
463
489
  static VALUE Map_clear(VALUE _self) {
464
490
  upb_Map_Clear(Map_GetMutable(_self));
@@ -466,10 +492,11 @@ static VALUE Map_clear(VALUE _self) {
466
492
  }
467
493
 
468
494
  /*
469
- * call-seq:
470
- * Map.length
495
+ * ruby-doc: Map#length
471
496
  *
472
497
  * Returns the number of entries (key-value pairs) in the map.
498
+ *
499
+ * @return [Integer]
473
500
  */
474
501
  static VALUE Map_length(VALUE _self) {
475
502
  Map* self = ruby_to_Map(_self);
@@ -477,11 +504,12 @@ static VALUE Map_length(VALUE _self) {
477
504
  }
478
505
 
479
506
  /*
480
- * call-seq:
481
- * Map.dup => new_map
507
+ * ruby-doc: Map#dup
482
508
  *
483
509
  * Duplicates this map with a shallow copy. References to all non-primitive
484
510
  * element objects (e.g., submessages) are shared.
511
+ *
512
+ * @return [Map]
485
513
  */
486
514
  static VALUE Map_dup(VALUE _self) {
487
515
  Map* self = ruby_to_Map(_self);
@@ -502,8 +530,7 @@ static VALUE Map_dup(VALUE _self) {
502
530
  }
503
531
 
504
532
  /*
505
- * call-seq:
506
- * Map.==(other) => boolean
533
+ * ruby-doc: Map#==
507
534
  *
508
535
  * Compares this map to another. Maps are equal if they have identical key sets,
509
536
  * and for each key, the values in both maps compare equal. Elements are
@@ -513,6 +540,9 @@ static VALUE Map_dup(VALUE _self) {
513
540
  * Maps with dissimilar key types or value types/typeclasses are never equal,
514
541
  * even if value comparison (for example, between integers and floats) would
515
542
  * have otherwise indicated that every element has equal value.
543
+ *
544
+ * @param other [Map]
545
+ * @return [Boolean]
516
546
  */
517
547
  VALUE Map_eq(VALUE _self, VALUE _other) {
518
548
  Map* self = ruby_to_Map(_self);
@@ -560,12 +590,13 @@ VALUE Map_eq(VALUE _self, VALUE _other) {
560
590
  }
561
591
 
562
592
  /*
563
- * call-seq:
564
- * Map.frozen? => bool
593
+ * ruby-doc: Map#frozen?
565
594
  *
566
595
  * Returns true if the map is frozen in either Ruby or the underlying
567
596
  * representation. Freezes the Ruby map object if it is not already frozen in
568
597
  * Ruby but it is frozen in the underlying representation.
598
+ *
599
+ * @return [Boolean]
569
600
  */
570
601
  VALUE Map_frozen(VALUE _self) {
571
602
  Map* self = ruby_to_Map(_self);
@@ -580,11 +611,12 @@ VALUE Map_frozen(VALUE _self) {
580
611
  }
581
612
 
582
613
  /*
583
- * call-seq:
584
- * Map.freeze => self
614
+ * ruby-doc: Map#freeze
585
615
  *
586
616
  * Freezes the map object. We have to intercept this so we can freeze the
587
617
  * underlying representation, not just the Ruby wrapper.
618
+ *
619
+ * @return [self]
588
620
  */
589
621
  VALUE Map_freeze(VALUE _self) {
590
622
  Map* self = ruby_to_Map(_self);
@@ -637,10 +669,11 @@ VALUE Map_EmptyFrozen(const upb_FieldDef* f) {
637
669
  }
638
670
 
639
671
  /*
640
- * call-seq:
641
- * Map.hash => hash_value
672
+ * ruby-doc: Map#hash
642
673
  *
643
674
  * Returns a hash value based on this map's contents.
675
+ *
676
+ * @return [Integer]
644
677
  */
645
678
  VALUE Map_hash(VALUE _self) {
646
679
  Map* self = ruby_to_Map(_self);
@@ -658,10 +691,11 @@ VALUE Map_hash(VALUE _self) {
658
691
  }
659
692
 
660
693
  /*
661
- * call-seq:
662
- * Map.to_h => {}
694
+ * ruby-doc: Map#to_h
663
695
  *
664
696
  * Returns a Ruby Hash object containing all the values within the map
697
+ *
698
+ * @return [Hash]
665
699
  */
666
700
  VALUE Map_to_h(VALUE _self) {
667
701
  Map* self = ruby_to_Map(_self);
@@ -669,12 +703,13 @@ VALUE Map_to_h(VALUE _self) {
669
703
  }
670
704
 
671
705
  /*
672
- * call-seq:
673
- * Map.inspect => string
706
+ * ruby-doc: Map#inspect
674
707
  *
675
708
  * Returns a string representing this map's elements. It will be formatted as
676
709
  * "{key => value, key => value, ...}", with each key and value string
677
710
  * representation computed by its own #inspect method.
711
+ *
712
+ * @return [String]
678
713
  */
679
714
  VALUE Map_inspect(VALUE _self) {
680
715
  Map* self = ruby_to_Map(_self);
@@ -687,13 +722,15 @@ VALUE Map_inspect(VALUE _self) {
687
722
  }
688
723
 
689
724
  /*
690
- * call-seq:
691
- * Map.merge(other_map) => map
725
+ * ruby-doc: Map#merge
692
726
  *
693
727
  * Copies key/value pairs from other_map into a copy of this map. If a key is
694
728
  * set in other_map and this map, the value from other_map overwrites the value
695
729
  * in the new copy of this map. Returns the new copy of this map with merged
696
730
  * contents.
731
+ *
732
+ * @param other_map [Map]
733
+ * @return [Map]
697
734
  */
698
735
  static VALUE Map_merge(VALUE _self, VALUE hashmap) {
699
736
  VALUE dupped = Map_dup(_self);
@@ -420,11 +420,10 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f,
420
420
  }
421
421
 
422
422
  /*
423
- * call-seq:
424
- * Message.method_missing(*args)
423
+ * ruby-doc: AbstractMessage
425
424
  *
426
- * Provides accessors and setters and methods to clear and check for presence of
427
- * message fields according to their field names.
425
+ * The {AbstractMessage} class is the parent class for all Protobuf messages,
426
+ * and is generated from C code.
428
427
  *
429
428
  * For any field whose name does not conflict with a built-in method, an
430
429
  * accessor is provided with the same name as the field, and a setter is
@@ -653,16 +652,12 @@ void Message_InitFromValue(upb_Message* msg, const upb_MessageDef* m, VALUE val,
653
652
  }
654
653
 
655
654
  /*
656
- * call-seq:
657
- * Message.new(kwargs) => new_message
655
+ * ruby-doc: AbstractMessage#initialize
658
656
  *
659
657
  * Creates a new instance of the given message class. Keyword arguments may be
660
658
  * provided with keywords corresponding to field names.
661
659
  *
662
- * Note that no literal Message class exists. Only concrete classes per message
663
- * type exist, as provided by the #msgclass method on Descriptors after they
664
- * have been added to a pool. The method definitions described here on the
665
- * Message class are provided on each concrete message class.
660
+ * @param kwargs the list of field keys and values.
666
661
  */
667
662
  static VALUE Message_initialize(int argc, VALUE* argv, VALUE _self) {
668
663
  Message* self = ruby_to_Message(_self);
@@ -684,10 +679,11 @@ static VALUE Message_initialize(int argc, VALUE* argv, VALUE _self) {
684
679
  }
685
680
 
686
681
  /*
687
- * call-seq:
688
- * Message.dup => new_message
682
+ * ruby-doc: AbstractMessage#dup
689
683
  *
690
684
  * Performs a shallow copy of this message and returns the new copy.
685
+ *
686
+ * @return [AbstractMessage]
691
687
  */
692
688
  static VALUE Message_dup(VALUE _self) {
693
689
  Message* self = ruby_to_Message(_self);
@@ -700,13 +696,15 @@ static VALUE Message_dup(VALUE _self) {
700
696
  }
701
697
 
702
698
  /*
703
- * call-seq:
704
- * Message.==(other) => boolean
699
+ * ruby-doc: AbstractMessage#==
705
700
  *
706
701
  * Performs a deep comparison of this message with another. Messages are equal
707
702
  * if they have the same type and if each field is equal according to the :==
708
703
  * method's semantics (a more efficient comparison may actually be done if the
709
704
  * field is of a primitive type).
705
+ *
706
+ * @param other [AbstractMessage]
707
+ * @return [Boolean]
710
708
  */
711
709
  static VALUE Message_eq(VALUE _self, VALUE _other) {
712
710
  if (CLASS_OF(_self) != CLASS_OF(_other)) return Qfalse;
@@ -735,10 +733,11 @@ uint64_t Message_Hash(const upb_Message* msg, const upb_MessageDef* m,
735
733
  }
736
734
 
737
735
  /*
738
- * call-seq:
739
- * Message.hash => hash_value
736
+ * ruby-doc: AbstractMessage#hash
740
737
  *
741
738
  * Returns a hash value that represents this message's field values.
739
+ *
740
+ * @return [Integer]
742
741
  */
743
742
  static VALUE Message_hash(VALUE _self) {
744
743
  Message* self = ruby_to_Message(_self);
@@ -749,12 +748,13 @@ static VALUE Message_hash(VALUE _self) {
749
748
  }
750
749
 
751
750
  /*
752
- * call-seq:
753
- * Message.inspect => string
751
+ * ruby-doc: AbstractMessage#inspect
754
752
  *
755
753
  * Returns a human-readable string representing this message. It will be
756
754
  * formatted as "<MessageType: field1: value1, field2: value2, ...>". Each
757
755
  * field's value is represented according to its own #inspect method.
756
+ *
757
+ * @return [String]
758
758
  */
759
759
  static VALUE Message_inspect(VALUE _self) {
760
760
  Message* self = ruby_to_Message(_self);
@@ -830,10 +830,11 @@ VALUE Scalar_CreateHash(upb_MessageValue msgval, TypeInfo type_info) {
830
830
  }
831
831
 
832
832
  /*
833
- * call-seq:
834
- * Message.to_h => {}
833
+ * ruby-doc: AbstractMessage#to_h
835
834
  *
836
835
  * Returns the message as a Ruby Hash object, with keys as symbols.
836
+ *
837
+ * @return [Hash]
837
838
  */
838
839
  static VALUE Message_to_h(VALUE _self) {
839
840
  Message* self = ruby_to_Message(_self);
@@ -841,12 +842,13 @@ static VALUE Message_to_h(VALUE _self) {
841
842
  }
842
843
 
843
844
  /*
844
- * call-seq:
845
- * Message.frozen? => bool
845
+ * ruby-doc: AbstractMessage#frozen?
846
846
  *
847
847
  * Returns true if the message is frozen in either Ruby or the underlying
848
848
  * representation. Freezes the Ruby message object if it is not already frozen
849
849
  * in Ruby but it is frozen in the underlying representation.
850
+ *
851
+ * @return [Boolean]
850
852
  */
851
853
  VALUE Message_frozen(VALUE _self) {
852
854
  Message* self = ruby_to_Message(_self);
@@ -861,11 +863,12 @@ VALUE Message_frozen(VALUE _self) {
861
863
  }
862
864
 
863
865
  /*
864
- * call-seq:
865
- * Message.freeze => self
866
+ * ruby-doc: AbstractMessage#freeze
866
867
  *
867
868
  * Freezes the message object. We have to intercept this so we can freeze the
868
869
  * underlying representation, not just the Ruby wrapper.
870
+ *
871
+ * @return [self]
869
872
  */
870
873
  VALUE Message_freeze(VALUE _self) {
871
874
  Message* self = ruby_to_Message(_self);
@@ -882,11 +885,13 @@ VALUE Message_freeze(VALUE _self) {
882
885
  }
883
886
 
884
887
  /*
885
- * call-seq:
886
- * Message.[](index) => value
888
+ * ruby-doc: AbstractMessage#[]
887
889
  *
888
890
  * Accesses a field's value by field name. The provided field name should be a
889
891
  * string.
892
+ *
893
+ * @param index [Integer]
894
+ * @return [Object]
890
895
  */
891
896
  static VALUE Message_index(VALUE _self, VALUE field_name) {
892
897
  Message* self = ruby_to_Message(_self);
@@ -903,11 +908,14 @@ static VALUE Message_index(VALUE _self, VALUE field_name) {
903
908
  }
904
909
 
905
910
  /*
906
- * call-seq:
907
- * Message.[]=(index, value)
911
+ * ruby-doc: AbstractMessage#[]=
908
912
  *
909
913
  * Sets a field's value by field name. The provided field name should be a
910
914
  * string.
915
+ *
916
+ * @param index [Integer]
917
+ * @param value [Object]
918
+ * @return [nil]
911
919
  */
912
920
  static VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value) {
913
921
  Message* self = ruby_to_Message(_self);
@@ -929,14 +937,16 @@ static VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value) {
929
937
  }
930
938
 
931
939
  /*
932
- * call-seq:
933
- * MessageClass.decode(data, options) => message
940
+ * ruby-doc: AbstractMessage.decode
934
941
  *
935
942
  * Decodes the given data (as a string containing bytes in protocol buffers wire
936
943
  * format) under the interpretation given by this message class's definition
937
944
  * and returns a message object with the corresponding field values.
938
- * @param options [Hash] options for the decoder
939
- * recursion_limit: set to maximum decoding depth for message (default is 64)
945
+ * @param data [String]
946
+ * @param options [Hash]
947
+ * @option recursion_limit [Integer] set to maximum decoding depth for message
948
+ * (default is 64)
949
+ * @return [AbstractMessage]
940
950
  */
941
951
  static VALUE Message_decode(int argc, VALUE* argv, VALUE klass) {
942
952
  VALUE data = argv[0];
@@ -989,16 +999,17 @@ VALUE Message_decode_bytes(int size, const char* bytes, int options,
989
999
  }
990
1000
 
991
1001
  /*
992
- * call-seq:
993
- * MessageClass.decode_json(data, options = {}) => message
1002
+ * ruby-doc: AbstractMessage.decode_json
994
1003
  *
995
1004
  * Decodes the given data (as a string containing bytes in protocol buffers wire
996
1005
  * format) under the interpretration given by this message class's definition
997
1006
  * and returns a message object with the corresponding field values.
998
1007
  *
999
- * @param options [Hash] options for the decoder
1000
- * ignore_unknown_fields: set true to ignore unknown fields (default is to
1001
- * raise an error)
1008
+ * @param data [String]
1009
+ * @param options [Hash]
1010
+ * @option ignore_unknown_fields [Boolean] set true to ignore unknown fields
1011
+ * (default is to raise an error)
1012
+ * @return [AbstractMessage]
1002
1013
  */
1003
1014
  static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
1004
1015
  VALUE data = argv[0];
@@ -1057,13 +1068,16 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
1057
1068
  }
1058
1069
 
1059
1070
  /*
1060
- * call-seq:
1061
- * MessageClass.encode(msg, options) => bytes
1071
+ * ruby-doc: AbstractMessage.encode
1062
1072
  *
1063
1073
  * Encodes the given message object to its serialized form in protocol buffers
1064
1074
  * wire format.
1065
- * @param options [Hash] options for the encoder
1066
- * recursion_limit: set to maximum encoding depth for message (default is 64)
1075
+ *
1076
+ * @param msg [AbstractMessage]
1077
+ * @param options [Hash]
1078
+ * @option recursion_limit [Integer] set to maximum encoding depth for message
1079
+ * (default is 64)
1080
+ * @return [String]
1067
1081
  */
1068
1082
  static VALUE Message_encode(int argc, VALUE* argv, VALUE klass) {
1069
1083
  Message* msg = ruby_to_Message(argv[0]);
@@ -1110,14 +1124,17 @@ static VALUE Message_encode(int argc, VALUE* argv, VALUE klass) {
1110
1124
  }
1111
1125
 
1112
1126
  /*
1113
- * call-seq:
1114
- * MessageClass.encode_json(msg, options = {}) => json_string
1127
+ * ruby-doc: AbstractMessage.encode_json
1115
1128
  *
1116
1129
  * Encodes the given message object into its serialized JSON representation.
1117
- * @param options [Hash] options for the decoder
1118
- * preserve_proto_fieldnames: set true to use original fieldnames (default is
1119
- * to camelCase) emit_defaults: set true to emit 0/false values (default is to
1120
- * omit them)
1130
+ *
1131
+ * @param msg [AbstractMessage]
1132
+ * @param options [Hash]
1133
+ * @option preserve_proto_fieldnames [Boolean] set true to use original
1134
+ * fieldnames (default is to camelCase)
1135
+ * @option emit_defaults [Boolean] set true to emit 0/false values (default is
1136
+ * to omit them)
1137
+ * @return [String]
1121
1138
  */
1122
1139
  static VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
1123
1140
  Message* msg = ruby_to_Message(argv[0]);
@@ -1185,11 +1202,12 @@ static VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
1185
1202
  }
1186
1203
 
1187
1204
  /*
1188
- * call-seq:
1189
- * Message.descriptor => descriptor
1205
+ * ruby-doc: AbstractMessage.descriptor
1190
1206
  *
1191
1207
  * Class method that returns the Descriptor instance corresponding to this
1192
1208
  * message class's type.
1209
+ *
1210
+ * @return [Descriptor]
1193
1211
  */
1194
1212
  static VALUE Message_descriptor(VALUE klass) {
1195
1213
  return rb_ivar_get(klass, descriptor_instancevar_interned);
@@ -1212,12 +1230,26 @@ VALUE build_class_from_descriptor(VALUE descriptor) {
1212
1230
  return klass;
1213
1231
  }
1214
1232
 
1233
+ /* ruby-doc: Enum
1234
+ *
1235
+ * There isn't really a concrete `Enum` module generated by Protobuf. Instead,
1236
+ * you can use this documentation as an indicator of methods that are defined on
1237
+ * each `Enum` module that is generated. E.g. if you have:
1238
+ *
1239
+ * enum my_enum_type
1240
+ *
1241
+ * in your Proto file and generate Ruby code, a module
1242
+ * called `MyEnumType` will be generated with the following methods available.
1243
+ */
1244
+
1215
1245
  /*
1216
- * call-seq:
1217
- * Enum.lookup(number) => name
1246
+ * ruby-doc: Enum.lookup
1218
1247
  *
1219
1248
  * This module method, provided on each generated enum module, looks up an enum
1220
1249
  * value by number and returns its name as a Ruby symbol, or nil if not found.
1250
+ *
1251
+ * @param number [Integer]
1252
+ * @return [String]
1221
1253
  */
1222
1254
  static VALUE enum_lookup(VALUE self, VALUE number) {
1223
1255
  int32_t num = NUM2INT(number);
@@ -1232,11 +1264,13 @@ static VALUE enum_lookup(VALUE self, VALUE number) {
1232
1264
  }
1233
1265
 
1234
1266
  /*
1235
- * call-seq:
1236
- * Enum.resolve(name) => number
1267
+ * ruby-doc: Enum.resolve
1237
1268
  *
1238
1269
  * This module method, provided on each generated enum module, looks up an enum
1239
1270
  * value by name (as a Ruby symbol) and returns its name, or nil if not found.
1271
+ *
1272
+ * @param name [String]
1273
+ * @return [Integer]
1240
1274
  */
1241
1275
  static VALUE enum_resolve(VALUE self, VALUE sym) {
1242
1276
  const char* name = rb_id2name(SYM2ID(sym));
@@ -1251,11 +1285,13 @@ static VALUE enum_resolve(VALUE self, VALUE sym) {
1251
1285
  }
1252
1286
 
1253
1287
  /*
1254
- * call-seq:
1255
- * Enum.descriptor
1288
+ * ruby-doc: Enum.descriptor
1256
1289
  *
1257
1290
  * This module method, provided on each generated enum module, returns the
1258
- * EnumDescriptor corresponding to this enum type.
1291
+ * {EnumDescriptor} corresponding to this enum type.
1292
+ *
1293
+ * @return [EnumDescriptor]
1294
+ *
1259
1295
  */
1260
1296
  static VALUE enum_descriptor(VALUE self) {
1261
1297
  return rb_ivar_get(self, descriptor_instancevar_interned);
@@ -183,7 +183,7 @@ const rb_data_type_t Arena_type = {
183
183
  };
184
184
 
185
185
  static void *ruby_upb_allocfunc(upb_alloc *alloc, void *ptr, size_t oldsize,
186
- size_t size) {
186
+ size_t size, size_t *actual_size) {
187
187
  if (size == 0) {
188
188
  xfree(ptr);
189
189
  return NULL;
@@ -97,6 +97,4 @@ void Protobuf_CheckNotFrozen(VALUE val, bool upb_frozen);
97
97
 
98
98
  #define PBRUBY_MAX(x, y) (((x) > (y)) ? (x) : (y))
99
99
 
100
- #define UPB_UNUSED(var) (void)var
101
-
102
100
  #endif // __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__