mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Recover String#to_str; ref #4177
We have removed implicit conversion to strings using `to_str`. But some people still using `to_str` as a typical string method, i.e. they do string check by code like: `obj.respond_to?(:to_str)`. So we have recovered the method.
This commit is contained in:
@@ -2754,6 +2754,7 @@ mrb_init_string(mrb_state *mrb)
|
||||
#endif
|
||||
mrb_define_method(mrb, s, "to_i", mrb_str_to_i, MRB_ARGS_ANY()); /* 15.2.10.5.39 */
|
||||
mrb_define_method(mrb, s, "to_s", mrb_str_to_s, MRB_ARGS_NONE()); /* 15.2.10.5.40 */
|
||||
mrb_define_method(mrb, s, "to_str", mrb_str_to_s, MRB_ARGS_NONE());
|
||||
mrb_define_method(mrb, s, "to_sym", mrb_str_intern, MRB_ARGS_NONE()); /* 15.2.10.5.41 */
|
||||
mrb_define_method(mrb, s, "upcase", mrb_str_upcase, MRB_ARGS_NONE()); /* 15.2.10.5.42 */
|
||||
mrb_define_method(mrb, s, "upcase!", mrb_str_upcase_bang, MRB_ARGS_NONE()); /* 15.2.10.5.43 */
|
||||
|
||||
Reference in New Issue
Block a user