Module | MusicBrainz::CoreExtensions::Range::Equality |
In: |
lib/rbrainz/core_ext/range/equality.rb
|
Mixin module with equality operations for ranges. The built-in Range class is currently missing functions to compare a Range with another Range. There exist 13 disjoint equality operations for ranges. This mixin implements them all and a few extra operations for commonly used combinations.
a.contains?(b) is true, if b fits completely into a. Same as b.during?(a).
|A------------| |B------|
a.during?(b) is true, if a fits completely into b. Same as b.contains?(a).
|A------| |B------------|
a.finished_by?(b) is true, if a and b have the same end but b begins after a. Same as b.finishes?(a).
|A-----------| |B------|
a.finishes?(b) is true, if a and b have the same end but a begins after b. Same as b.finished_by?(a).
|A------| |B-----------|
a.meets_beginning_of?(b) is true, if b begins exactly at the end of a. Same as b.meets_end_of?(a).
|A------| |B------|
a.meets_end_of?(b) is true, if b ends exactly at the beginning of a. Same as b.meets_beginning_of?(a).
|A------| |B------|
a.overlaps_beginning_of?(b) is true, if a overlaps the beginning of b. Same as b.overlaps_end_of?(a).
|A------| |B------|
a.overlaps_end_of?(b) is true, if a overlaps the end of b. Same as b.overlaps_beginning_of?(a).
|A------| |B------|
a.started_by?(b) is true, if a and b have the same beginning but a lasts longer than b. Same as b.starts?(a).
|A-----------| |B------|