The Range
class describes the interval. The range object
is created by the range operator (..
or ...
).
For example:
for i in 1..5 ... end
This means to create an interval from 1 to 5 by ..
operator, and iterate over each value within the interval.
The operands for the range operator must respond to the
upto
method.
Note That an interval contains both ends.
Object
Enumerable
new(first,last)
Creates the range object from first to last.
self === other
Returns true if other
is within the range. This operator
is mostly used by the case
statement.
each {|item| ...}
Iterates over each item within the range.
first
Returns the start point of the range.
last
Returns the end point of the range.