1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* range.c (rb_range_beg_len): check if responds to "begin" and "end"

methods for non-Range object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-02-15 15:21:51 +00:00
parent 41ca14e8ac
commit 9c0be2d516
3 changed files with 12 additions and 11 deletions

View file

@ -1,3 +1,8 @@
Sat Feb 16 00:21:49 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* range.c (rb_range_beg_len): check if responds to "begin" and "end"
methods for non-Range object.
Fri Feb 15 20:29:42 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage

12
range.c
View file

@ -597,12 +597,10 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
excl = EXCL(range);
}
else {
b = rb_check_to_integer(range, "begin");
if (NIL_P(b))
return Qfalse;
e = rb_check_to_integer(range, "end");
if (NIL_P(e))
return Qfalse;
if (!rb_respond_to(range, id_beg)) return Qfalse;
if (!rb_respond_to(range, id_end)) return Qfalse;
b = rb_funcall(range, id_beg, 0);
e = rb_funcall(range, id_end, 0);
excl = RTEST(rb_funcall(range, rb_intern("exclude_end?"), 0));
}
beg = NUM2LONG(b);
@ -751,8 +749,6 @@ range_include(VALUE range, VALUE val)
}
else if (TYPE(beg) == T_STRING && TYPE(end) == T_STRING &&
RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
rb_encoding *enc = rb_enc_check(beg, end);
if (NIL_P(val)) return Qfalse;
if (TYPE(val) == T_STRING) {
if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-02-15"
#define RUBY_RELEASE_DATE "2008-02-16"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080215
#define RUBY_RELEASE_CODE 20080216
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 15
#define RUBY_RELEASE_DAY 16
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];