Skip to content
Permalink
Browse files
Let Fixnum#{ceil,floor,round,truncate} to return itself; #3652
  • Loading branch information
matz committed May 26, 2017
1 parent 06c4933 commit c80696fcd33ad6b0c29efad759252ae28b0baa3d
Showing 1 changed file with 4 additions and 0 deletions.
@@ -1334,6 +1334,10 @@ mrb_init_numeric(mrb_state *mrb)
mrb_define_method(mrb, fixnum, "to_s", fix_to_s, MRB_ARGS_NONE()); /* 15.2.8.3.25 */
mrb_define_method(mrb, fixnum, "inspect", fix_to_s, MRB_ARGS_NONE());
mrb_define_method(mrb, fixnum, "divmod", fix_divmod, MRB_ARGS_REQ(1)); /* 15.2.8.3.30 (x) */
mrb_define_method(mrb, fixnum, "ceil", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.8 (x) */
mrb_define_method(mrb, fixnum, "floor", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.10 (x) */
mrb_define_method(mrb, fixnum, "round", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.12 (x) */
mrb_define_method(mrb, fixnum, "truncate", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.15 (x) */

/* Float Class */
mrb->float_class = fl = mrb_define_class(mrb, "Float", numeric); /* 15.2.9 */

0 comments on commit c80696f

Please sign in to comment.