summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-numeric-ext
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-07-21 22:59:41 +0900
committerKOBAYASHI Shuji <[email protected]>2019-07-21 22:59:41 +0900
commitc980fe279266448cf5ac8faa646d57d0f8561b10 (patch)
tree262fbfcf1686d0a80204664a8e5e93d4a7164b36 /mrbgems/mruby-numeric-ext
parentcf4cddf7a1e67109ca36f058719fa62c48b6b315 (diff)
downloadmruby-c980fe279266448cf5ac8faa646d57d0f8561b10.tar.gz
mruby-c980fe279266448cf5ac8faa646d57d0f8561b10.zip
Integrate `Integral#chr` (`Fixnum#chr`) to `mruby-string-ext`
Because they're defined in both `mruby-string-ext` and `mruby-numeric-ext` (they seem more natural to define in N, but `mruby-string-ext` depends on `Integral#chr`).
Diffstat (limited to 'mrbgems/mruby-numeric-ext')
-rw-r--r--mrbgems/mruby-numeric-ext/src/numeric_ext.c27
-rw-r--r--mrbgems/mruby-numeric-ext/test/numeric.rb8
2 files changed, 0 insertions, 35 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));
diff --git a/mrbgems/mruby-numeric-ext/test/numeric.rb b/mrbgems/mruby-numeric-ext/test/numeric.rb
index c85cb61f2..efdf25a34 100644
--- a/mrbgems/mruby-numeric-ext/test/numeric.rb
+++ b/mrbgems/mruby-numeric-ext/test/numeric.rb
@@ -1,14 +1,6 @@
##
# Numeric(Ext) Test
-assert('Integer#chr') do
- assert_equal("A", 65.chr)
- assert_equal("B", 0x42.chr)
-
- # multibyte encoding (not support yet)
- assert_raise(RangeError) { 256.chr }
-end
-
assert('Integer#div') do
assert_equal 52, 365.div(7)
end