From a6eded88af6390cccf009bc3da4eb44ab71a42fd Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 5 Apr 2008 01:05:03 +0000 Subject: * object.c (rb_check_to_integer): backported for range_step. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'object.c') diff --git a/object.c b/object.c index 5b2a255d0c..3e2fb58ab4 100644 --- a/object.c +++ b/object.c @@ -2199,6 +2199,19 @@ rb_to_integer(val, method) return v; } +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; -- cgit v1.2.3