diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-07-22 21:40:02 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-07-22 21:40:02 +0900 |
| commit | 5166e316efc9bd211b3d950d3586a45b22a5f9d5 (patch) | |
| tree | ea96b0f65909b42113851ded0647bc4586b22a8a /mrbgems/mruby-numeric-ext/src/numeric_ext.c | |
| parent | d2dd2d0e4874ac2522f12b1599842e6cc666088d (diff) | |
| parent | c980fe279266448cf5ac8faa646d57d0f8561b10 (diff) | |
| download | mruby-5166e316efc9bd211b3d950d3586a45b22a5f9d5.tar.gz mruby-5166e316efc9bd211b3d950d3586a45b22a5f9d5.zip | |
Merge pull request #4591 from shuujii/integrate-Integral-chr-Fixnum-chr-to-mruby-string-ext
Integrate `Integral#chr` (`Fixnum#chr`) to `mruby-string-ext`
Diffstat (limited to 'mrbgems/mruby-numeric-ext/src/numeric_ext.c')
| -rw-r--r-- | mrbgems/mruby-numeric-ext/src/numeric_ext.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index cd8bbf187..86c384a87 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -9,32 +9,6 @@ to_int(mrb_state *mrb, mrb_value x) } /* - * Document-method: Integer#chr - * call-seq: - * int.chr -> string - * - * Returns a string containing the character represented by the +int+'s value - * according to +encoding+. - * - * 65.chr #=> "A" - * 230.chr #=> "\xE6" - */ -static mrb_value -mrb_int_chr(mrb_state *mrb, mrb_value x) -{ - mrb_int chr; - char c; - - chr = to_int(mrb, x); - if (chr >= (1 << CHAR_BIT)) { - mrb_raisef(mrb, E_RANGE_ERROR, "%S out of char range", x); - } - c = (char)chr; - - return mrb_str_new(mrb, &c, 1); -} - -/* * call-seq: * int.allbits?(mask) -> true or false * @@ -87,7 +61,6 @@ mrb_mruby_numeric_ext_gem_init(mrb_state* mrb) { struct RClass *i = mrb_module_get(mrb, "Integral"); - mrb_define_method(mrb, i, "chr", mrb_int_chr, MRB_ARGS_NONE()); mrb_define_method(mrb, i, "allbits?", mrb_int_allbits, MRB_ARGS_REQ(1)); mrb_define_method(mrb, i, "anybits?", mrb_int_anybits, MRB_ARGS_REQ(1)); mrb_define_method(mrb, i, "nobits?", mrb_int_nobits, MRB_ARGS_REQ(1)); |
