diff options
author | Shugo Maeda <[email protected]> | 2021-10-21 16:21:08 +0900 |
---|---|---|
committer | Shugo Maeda <[email protected]> | 2021-10-21 16:31:54 +0900 |
commit | 6606597109bdb535a150606323ce3d8f5750e1f6 (patch) | |
tree | 153eac378825ad9b17be9e8ae10d80572641f2c5 /include/ruby | |
parent | 7185c00fcc330db8951b684f548ba3d10983bb92 (diff) |
Deprecate include/prepend in refinements and add Refinement#import_methods instead
Refinement#import_methods imports methods from modules.
Unlike Module#include, it copies methods and adds them into the refinement,
so the refinement is activated in the imported methods.
[Bug #17429] [ruby-core:101639]
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/globals.h | 1 | ||||
-rw-r--r-- | include/ruby/internal/intern/class.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/ruby/internal/globals.h b/include/ruby/internal/globals.h index b478e30b04..5a414fc472 100644 --- a/include/ruby/internal/globals.h +++ b/include/ruby/internal/globals.h @@ -82,6 +82,7 @@ RUBY_EXTERN VALUE rb_cInteger; /**< `Module` class. */ RUBY_EXTERN VALUE rb_cMatch; /**< `MatchData` class. */ RUBY_EXTERN VALUE rb_cMethod; /**< `Method` class. */ RUBY_EXTERN VALUE rb_cModule; /**< `Module` class. */ +RUBY_EXTERN VALUE rb_cRefinement; /**< `Refinement` class. */ RUBY_EXTERN VALUE rb_cNameErrorMesg; /**< `NameError::Message` class. */ RUBY_EXTERN VALUE rb_cNilClass; /**< `NilClass` class. */ RUBY_EXTERN VALUE rb_cNumeric; /**< `Numeric` class. */ diff --git a/include/ruby/internal/intern/class.h b/include/ruby/internal/intern/class.h index af0c0768b8..60baf98472 100644 --- a/include/ruby/internal/intern/class.h +++ b/include/ruby/internal/intern/class.h @@ -100,6 +100,14 @@ VALUE rb_define_class_id_under(VALUE outer, ID id, VALUE super); */ VALUE rb_module_new(void); + +/** + * Creates a new, anonymous refinement. + * + * @return An anonymous refinement. + */ +VALUE rb_refinement_new(void); + /** * This is a very badly designed API that creates an anonymous module. * |