Class: Range

Inherits:
Object
  • Object
show all
Defined in:
lib/cortex_reaver/snippets/range.rb

Instance Method Summary collapse

Instance Method Details

#|(other) ⇒ Object

Constructs the smallest range which covers this and other.



3
4
5
6
7
8
# File 'lib/cortex_reaver/snippets/range.rb', line 3

def |(other)
  my_end, other_end = self.end, other.end
  my_end -= 1 if self.exclude_end?
  other_end -= 1 if other.exclude_end?
  [self.begin, other.begin].min .. [my_end, other_end].max
end