Class Range
In: lib/facets/core/range/to_range.rb
lib/facets/core/range/within.rb
lib/facets/core/range/to_r.rb
lib/facets/core/range/umbrella.rb
lib/facets/core/range/overlap.rb
lib/facets/core/range/combine.rb
Parent: Object

TODO Need to incorporate end sentinal inclusion vs. exclusion.

Methods

combine   combine   overlap?   to_r   to_range   umbrella   within?  

Public Class methods

Combine intervals.

Public Instance methods

Combine intervals.

A thing really should know itself. This simply returns self.

A thing really should know itself. This simply returns self.

Note: This does not internally effect the Ruby interpretor such that it can coerce Range-like objects into a Range.

Returns a two element array of the relationship between two Ranges.

Diagram:

    Relationship     Returns

  self |-----------|
  r    |-----------|    [0,0]

  self |-----------|
  r     |---------|     [-1,-1]

  self  |---------|
  r    |-----------|    [1,1]

  self |-----------|
  r     |----------|    [-1,0]

  self |-----------|
  r     |-----------|   [-1,1]

  etc.

Example:

  (0..3).umbrella(1..2)  #=>  [-1,-1]

Uses the Range#umbrella method to determine if another Range is anywhere within this Range.

  (1..3).within?(0..4)  #=> true

[Validate]