From 607a809726cf1eb32e2d427cd25c77d1a35bb967 Mon Sep 17 00:00:00 2001 From: Run Paint Run Run Date: Mon, 24 Jan 2011 07:45:59 +0000 Subject: [PATCH] Ref/Range: Write reference page for Range. --- book.xml | 1 + src/ref/range.xml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/ref/range.xml diff --git a/book.xml b/book.xml index 636e5cc..c3b88a9 100644 --- a/book.xml +++ b/book.xml @@ -84,6 +84,7 @@ + diff --git a/src/ref/range.xml b/src/ref/range.xml new file mode 100644 index 0000000..a20bb9f --- /dev/null +++ b/src/ref/range.xml @@ -0,0 +1,40 @@ + + + + Range + + RangeRange.newbeginendexclusive Creates and returns a Range of begin to end, inclusive. If exclusive is true, end is omitted. + + true or falseRange#==object Returns true is a Range whose beginning and end values are #== to the corresponding values in the receiver, and they are both either exclusive or inclusive; otherwise, false. + + true or falseRange#===object Returns the value of Range#include? when passed object. + + ObjectRange#begin Returns the beginning value of the receiver. + + true or falseRange#cover?object Returns true if object is between—using the comparison operators—the beginning and end value of the receiver. If the receiver is inclusive, object may equal the end value; otherwise, it may not. + + RangeRange#each{|value| } Generates successive elements of the receiver with #succ, yielding them to the block. If the block is omitted, an Enumerator is returned. + + ObjectRange#end Returns the end value of the receiver. + + true or falseRange#eql?object Returns true is a Range whose beginning and end values are #eql? to the corresponding values in the receiver, and they are both either exclusive or inclusive; otherwise, false. + + true or falseRange#exclude_end? Return true if the receiver is exclusive; otherwise, false. + + Object or ArrayRange#firstn=1 Returns the first n elements of the receiver as an Array. If n is omitted, returns the first element itself. + + true or falseRange#include?object If the endpoints of the receiver are Numeric, behaves as Range#cover?. Otherwise, uses Enumerable#include? to determine whether object is an element of the receiver, returning true if it is; otherwise, false. Aliased by Range#member?. + + Object or ArrayRange#lastn=1 Returns the last n elements of the receiver as an Array. If n is omitted, returns the last element itself. + + Object or nilRange#max{|a,b| } Returns the largest element of the receiver, or nil if the beginning value exceeds the end value. If a block is given it is used to find the maximum value: it is passed each pair of elements in turn, and expected to behave like #<=>. + + true or falseRange#member?object Aliases Range#include?. + + Object or nilRange#min{|a,b| } Returns the smallest element of the receiver, or nil if the beginning value exceeds the end value. If a block is given it is used to find the maximum value: it is passed each pair of elements in turn, and expected to behave like #<=>. + + RangeRange#stepn=1{|value| } Generates successive elements of the receiver with #succ, or if the endpoints are numeric, #+, yielding every nth to the block. If the block is omitted, an Enumerator is returned. +