Sha256: 3abba45c5fff6d560e176ed11b8a772b7aa6b477a89cca719197c5b512202c8b
Contents?: true
Size: 676 Bytes
Versions: 17
Compression:
Stored size: 676 Bytes
Contents
unless (1..4).cover?(2..3) require 'backports/tools/alias_method_chain' class Range def cover_with_range_compatibility?(what) return cover_without_range_compatibility?(what) unless what.is_a?(Range) left = self.begin <=> what.begin right = self.end <=> what.end return false unless left && right left <= 0 && ( right >= 1 || right == 0 && (!exclude_end? || what.exclude_end?) || what.exclude_end? && what.begin.is_a?(Integer) && what.end.is_a?(Integer) && cover_without_range_compatibility?(what.end - 1) ) end Backports.alias_method_chain self, :cover?, :range_compatibility end end
Version data entries
17 entries across 17 versions & 1 rubygems