Make ObjectRange use the new Class.create syntax.

This commit is contained in:
Tobie Langel 2007-10-13 11:24:23 +00:00
parent 5d37d39988
commit e7bb042aa6
2 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,9 @@
*SVN*
* Make ObjectRange use the new Class.create syntax. [Mislav Marohnić]
* Fix a failing ClassCreate test case in IE. [Tobie Langel]
* Complete rewrite of the Hash class.
!! BACKWARDS COMPATIBILITY CHANGE !! This new version of Hash is NOT backwards compatible with the former Hash class.

View File

@ -1,4 +1,4 @@
ObjectRange = Class.create({
var ObjectRange = Class.create(Enumerable, {
initialize: function(start, end, exclusive) {
this.start = start;
this.end = end;
@ -11,19 +11,17 @@ ObjectRange = Class.create({
iterator(value);
value = value.succ();
}
}
},
include: function(value) {
if (value < this.start)
return false;
if (this.exclusive)
return value < this.end;
return value <= this.end;
}
});
Object.extend(ObjectRange.prototype, Enumerable);
ObjectRange.prototype.include = function(value) {
if (value < this.start)
return false;
if (this.exclusive)
return value < this.end;
return value <= this.end;
};
var $R = function(start, end, exclusive) {
return new ObjectRange(start, end, exclusive);
};