summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/object.c b/object.c
index 5b2a255d0c..3e2fb58ab4 100644
--- a/object.c
+++ b/object.c
@@ -2200,6 +2200,19 @@ rb_to_integer(val, method)
}
VALUE
+rb_check_to_integer(VALUE val, const char *method)
+{
+ VALUE v;
+
+ if (FIXNUM_P(val)) return val;
+ v = convert_type(val, "Integer", method, Qfalse);
+ if (!rb_obj_is_kind_of(v, rb_cInteger)) {
+ return Qnil;
+ }
+ return v;
+}
+
+VALUE
rb_to_int(val)
VALUE val;
{