Skip to content

Commit

Permalink
Make ObjectRange use the new Class.create syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobie committed Oct 13, 2007
1 parent 5d37d39 commit e7bb042
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -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.
Expand Down
22 changes: 10 additions & 12 deletions src/range.js
@@ -1,4 +1,4 @@
ObjectRange = Class.create({
var ObjectRange = Class.create(Enumerable, {
initialize: function(start, end, exclusive) {
this.start = start;
this.end = end;
Expand All @@ -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);
};

0 comments on commit e7bb042

Please sign in to comment.