Class: | IntGroup |
Parent: | Object |
Includes: | Enumerable |
The class IntGroup represents an unordered set of non-negative integers.
Create a new integer group. If no arguments are given, an empty group is returned. The arguments are either IntGroup, Range, Enumerable, or Numeric. In either case, the non-negative integers included in the arguments are added to the result. If a block is given, the block is called with the each integer in the given arguments, and the integer group consisting with the returned integers is returned.
Get the index-th point in self. If the index is out of range, nil is returned.
For each element n in self, get the n-th point in val, and return the result as a new group. If n is out of range, then that point is ignored.
See Also: IntGroup#deconvolute. If all points in self are within the range of val, then an equation self.convolute(val).deconvolute(val) == self holds.
For each element n in self, find the point n in val, and return the found indices as a new group. If n is not found in val, then that point is ignored.
See Also: IntGroup#convolute. If all points in self are found in val, then an equation self.deconvolute(val).convolute(val) == self holds.
Returns the index of the first element that is equal to the given value. In the second form, returns the index of the first element for which the associated block returns true. If no such element was found, returns nil.
Move all points by an integer value. A negative val is allowed, but it must be no smaller than -(self[0]), otherwise an exception is thrown.
Split self into consecutive chunks of integers, and return the val-th chunk as a Range. This method is relatively efficient, because it directly uses the internal representation of IntGroup.