Class Range
In: test/range.c
Parent: Object
Range TopLevel
Methods
==    ===    begin    each    end    eql?    exclude_end?    first    hash    initialize    inspect    last    length    size    to_s   
Public Instance methods
initialize(argc, argv, obj)

Range.new( start, end, exclusive=false ) -> aRange


Constructs a range using the given start and end. If the third parameter is omitted or is false, the range will include the end object; otherwise, it will be excluded.

==(p1)
===(range, obj)

rng === anObject -> true or false


Returns true if anObject is an element of rng, false otherwise. Conveniently, === is the comparison operator used by case statements.

      case 79
      when 1..50   then   print "low\n"
      when 51..75  then   print "medium\n"
      when 76..100 then   print "high\n"
      end
 produces:
      high
eql?(p1)
hash()
each()
first(obj)

rng.begin/rng.first -> anObject


Returns the first object in the range.

last(obj)

rng.last/rng.end -> anObject


Return the last object in range.

begin(obj)

rng.begin/rng.first -> anObject


Returns the first object in the range.

end(obj)

rng.last/rng.end -> anObject


Return the last object in range.

to_s()
inspect()
exclude_end?(range)

rng.exclude_end? -> true or false


Returns true if rng excludes its end value.

length(range)

rng.length/rng.size -> anInteger


Returns the number of objects in rng.

   (1..10).length    #=> 10
   (1...10).length   #=> 9
size(range)

rng.length/rng.size -> anInteger


Returns the number of objects in rng.

   (1..10).length    #=> 10
   (1...10).length   #=> 9