summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-05 01:05:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-05 01:05:03 +0000
commita6eded88af6390cccf009bc3da4eb44ab71a42fd (patch)
tree5af321a3e35840a89ac58043a7c4ba9746c52cb6 /object.c
parent5e50b5099f33b61f070ec010b040ee14334113c6 (diff)
downloadruby-a6eded88af6390cccf009bc3da4eb44ab71a42fd.tar.gz
* 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
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;
{