mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* range.c (range_eql, range_eq): fixed equality to work for
subclasses of Range. a patch from Marc-Andre Lafortune. [ruby-core:22190] * test/ruby/test_range.rb: add assertions for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c82826ce5f
commit
da19797648
3 changed files with 14 additions and 2 deletions
4
range.c
4
range.c
|
@ -125,7 +125,7 @@ range_eq(VALUE range, VALUE obj)
|
|||
{
|
||||
if (range == obj)
|
||||
return Qtrue;
|
||||
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
|
||||
if (!rb_obj_is_kind_of(obj, rb_cRange))
|
||||
return Qfalse;
|
||||
|
||||
if (!rb_equal(RANGE_BEG(range), RANGE_BEG(obj)))
|
||||
|
@ -187,7 +187,7 @@ range_eql(VALUE range, VALUE obj)
|
|||
{
|
||||
if (range == obj)
|
||||
return Qtrue;
|
||||
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
|
||||
if (!rb_obj_is_kind_of(obj, rb_cRange))
|
||||
return Qfalse;
|
||||
|
||||
if (!rb_eql(RANGE_BEG(range), RANGE_BEG(obj)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue