From: masaya.tarui@... Date: 2018-08-03T03:02:14+00:00 Subject: [ruby-core:88281] Re: [Ruby trunk Feature#14473] Add Range#subrange? I am happy that match opinion with you. I will commit based on your patch. It'll take a little while. -----Original Message----- From: ruby-core On Behalf Of owen@owenstephens.co.uk Sent: Thursday, August 2, 2018 8:42 AM To: ruby-core@ruby-lang.org Subject: [ruby-core:88265] [Ruby trunk Feature#14473] Add Range#subrange? Issue #14473 has been updated by owst (Owen Stephens). File v6-0001-range.c-allow-cover-to-accept-Range-argument.patch added I agree that the max performance issue is likely to be a rare case; I am happy to leave it as-is. Apologies on the second issue - I originally misunderstood "ignore" to mean "don't rescue". I've attached another updated patch - it rescues the TypeError raised by `max`, and also fixes the handling of endless/empty ranges. ---------------------------------------- Feature #14473: Add Range#subrange? https://bugs.ruby-lang.org/issues/14473#change-73289 * Author: greggzst (Grzegorz Jakubiak) * Status: Assigned * Priority: Normal * Assignee: tarui (Masaya Tarui) * Target version: ---------------------------------------- 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: ~~~ ruby (2..4).subrange?(1...4) => true (-2..2).subrange?(-1..3) => false ~~~ ---Files-------------------------------- 0001-range.c-add-subset-superset-methods.patch (8.84 KB) v2-0001-range.c-add-subset-superset-methods.patch (8.85 KB) v3-0001-range.c-add-subrange-superrange-methods.patch (9.24 KB) v4-0001-range.c-allow-cover-to-accept-Range-argument.patch (4.45 KB) v5-0001-range.c-allow-cover-to-accept-Range-argument.patch (4.82 KB) v6-0001-range.c-allow-cover-to-accept-Range-argument.patch (5.51 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: Unsubscribe: