Project

General

Profile

Actions

Feature #14473

closed

Add Range#subrange?

Added by greggzst (Grzegorz Jakubiak) almost 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:85528]

Description

Hi there,

I'd like to propose a method that returns true when a range that the method gets called on is a subrange of a range passed in as an argument.

Example:

(2..4).subrange?(1...4) 
=> true
(-2..2).subrange?(-1..3) 
=> false

Files

Actions

Also available in: Atom PDF