diff --git a/optional/capi/ext/hash_spec.c b/optional/capi/ext/hash_spec.c index f129f0622..69ef02d5d 100644 --- a/optional/capi/ext/hash_spec.c +++ b/optional/capi/ext/hash_spec.c @@ -105,9 +105,11 @@ VALUE hash_spec_rb_hash_new(VALUE self) { return rb_hash_new(); } +#ifdef RUBY_VERSION_IS_3_2 VALUE hash_spec_rb_hash_new_capa(VALUE self, VALUE capacity) { return rb_hash_new_capa(NUM2LONG(capacity)); } +#endif VALUE rb_ident_hash_new(void); /* internal.h, used in ripper */ @@ -153,7 +155,9 @@ void Init_hash_spec(void) { rb_define_method(cls, "rb_hash_lookup2", hash_spec_rb_hash_lookup2, 3); rb_define_method(cls, "rb_hash_lookup2_default_undef", hash_spec_rb_hash_lookup2_default_undef, 2); rb_define_method(cls, "rb_hash_new", hash_spec_rb_hash_new, 0); +#ifdef RUBY_VERSION_IS_3_2 rb_define_method(cls, "rb_hash_new_capa", hash_spec_rb_hash_new_capa, 1); +#endif rb_define_method(cls, "rb_ident_hash_new", hash_spec_rb_ident_hash_new, 0); rb_define_method(cls, "rb_hash_size", hash_spec_rb_hash_size, 1); rb_define_method(cls, "rb_hash_set_ifnone", hash_spec_rb_hash_set_ifnone, 2);