diff options
author | Jeremy Evans <[email protected]> | 2025-04-29 00:38:35 +0900 |
---|---|---|
committer | <[email protected]> | 2025-04-28 08:38:35 -0700 |
commit | 926411171d296859839745a536aa86bc1e18aa76 () | |
tree | bcdd6470cb594af4906e57bdedcf9d97f5e64362 /set.c | |
parent | 80a1a1bb8ae8435b916ae4f66a483e91ad31356a (diff) |
Support Marshal.{dump,load} for core Set
This was missed when adding core Set, because it's handled implicitly for T_OBJECT. Keep marshal compatibility between core Set and stdlib Set, so you can unmarshal core Set with stdlib Set and vice versa. Co-authored-by: Nobuyoshi Nakada <[email protected]>
Notes: Merged: https://.com/ruby/ruby/pull/13185 Merged-By: jeremyevans <[email protected]>
-rw-r--r-- | set.c | 67 |
1 files changed, 67 insertions, 0 deletions
@@ -99,6 +99,7 @@ VALUE rb_cSet; static ID id_each_entry; static ID id_any_p; static ID id_new; static ID id_set_iter_lev; #define RSET_INITIALIZED FL_USER1 @@ -1850,6 +1851,66 @@ set_i_hash(VALUE set) return ST2FIX(hval); } /* * Document-class: Set * @@ -2068,6 +2129,7 @@ Init_Set(void) id_each_entry = rb_intern_const("each_entry"); id_any_p = rb_intern_const("any?"); id_new = rb_intern_const("new"); id_set_iter_lev = rb_make_internal_id(); rb_define_alloc_func(rb_cSet, set_s_alloc); @@ -2132,7 +2194,12 @@ Init_Set(void) rb_define_method(rb_cSet, "superset?", set_i_superset, 1); rb_define_alias(rb_cSet, ">=", "superset?"); rb_define_method(rb_cSet, "to_a", set_i_to_a, 0); rb_define_method(rb_cSet, "to_set", set_i_to_set, -1); rb_provide("set.rb"); } |