Skip to content

Commit

Permalink
Merge pull request #7938 from alusco-scratch/patch-1
Browse files Browse the repository at this point in the history
Override Map.clone to use Map's dup method
  • Loading branch information
deannagarcia authored Oct 14, 2021
2 parents 12f70b7 + 00a7ea4 commit 5106dea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ruby/ext/google/protobuf_c/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ void Map_register(VALUE module) {
rb_define_method(klass, "length", Map_length, 0);
rb_define_method(klass, "size", Map_length, 0);
rb_define_method(klass, "dup", Map_dup, 0);
// Also define #clone so that we don't inherit Object#clone.
rb_define_method(klass, "clone", Map_dup, 0);
rb_define_method(klass, "==", Map_eq, 1);
rb_define_method(klass, "freeze", Map_freeze, 0);
rb_define_method(klass, "hash", Map_hash, 0);
Expand Down

0 comments on commit 5106dea

Please sign in to comment.