Class: RangeWithGaps::RangeWithMath

Inherits:
Range
  • Object
show all
Includes:
RangeMath
Defined in:
lib/range_with_gaps/range_with_math.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RangeMath

#&, #-, #adjacent?, #empty?, #mask?, #overlap?, #size, #|

Class Method Details

.from_range(range) ⇒ Object



7
8
9
# File 'lib/range_with_gaps/range_with_math.rb', line 7

def self.from_range(range)
  new range.begin, range.end, range.exclude_end?
end

Instance Method Details

#to_rangeObject



11
12
13
# File 'lib/range_with_gaps/range_with_math.rb', line 11

def to_range
  Range.new self.begin, self.end, exclude_end?
end