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)

Combine intervals.

### Public Instance methods

combine(*intervals)

Combine intervals.

overlap?(other)
to_r()

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

to_range()

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.

umbrella(r)

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]

within?(rng)

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

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

[Validate]