Class | Range |
In: |
lib/facet/range/within?.rb
lib/facet/range/umbrella.rb lib/facet/range/to_r.rb |
Parent: | Object |
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:
require 'facet/range/umbrella' (0..3).umbrella(1..2) #=> [-1,-1]
Uses the Range#umbrella method to determine if another Range is anywhere within this Range.
require 'facet/range/within?' (1..3).within?(0..4) #=> true