class Range

Public Instance Methods

combine(other) click to toggle source
# File lib/lite/ruby/range.rb, line 5
def combine(other)
  to_a.concat(other.to_a)
end
include_with_range?(other) click to toggle source
# File lib/lite/ruby/range.rb, line 9
def include_with_range?(other)
  return include?(other) unless other.is_a?(Range)

  operator = exclude_end? && !other.exclude_end? ? :< : :<=
  include?(other.first) && other.last.send(operator, last)
end
overlaps?(other) click to toggle source
# File lib/lite/ruby/safe/range.rb, line 5
def overlaps?(other)
  cover?(other.first) || other.cover?(first)
end
sample() click to toggle source
# File lib/lite/ruby/range.rb, line 16
def sample
  to_a.sample
end
shuffle() click to toggle source
# File lib/lite/ruby/range.rb, line 20
def shuffle
  to_a.shuffle
end
within?(other) click to toggle source
# File lib/lite/ruby/range.rb, line 24
def within?(other)
  cover?(other.first) && cover?(other.last)
end