From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 2676C1F4BE for ; Mon, 7 Oct 2019 16:47:54 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 204E4120971; Tue, 8 Oct 2019 01:47:44 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 90D27120946 for ; Tue, 8 Oct 2019 01:47:40 +0900 (JST) Received: by filter0096p3las1.sendgrid.net with SMTP id filter0096p3las1-30892-5D9B6C2B-71 2019-10-07 16:47:39.726263549 +0000 UTC m=+338628.603857386 Received: from herokuapp.com (unknown [54.158.92.1]) by ismtpd0038p1mdw1.sendgrid.net (SG) with ESMTP id eQXVbDLiRDGPO__7zSaUjw for ; Mon, 07 Oct 2019 16:47:39.842 +0000 (UTC) Date: Mon, 07 Oct 2019 16:47:39 +0000 (UTC) From: stevendaniels88@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70847 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16244 X-Redmine-Issue-Author: stevendaniels X-Redmine-Sender: stevendaniels X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?wmILHqzqLVzb3UFOeitWvWAgTOPWggHIH6J4WQp2V6UfYrq6O0+QQXTrl7MgBT?= =?us-ascii?Q?dycsFerqJHTvs6M+8w2wCp4t6l=2FQOfiHTUoYbiH?= =?us-ascii?Q?EPMksxRvuRoFGaWtqQI+jfHbLypchxICJv6bwuS?= =?us-ascii?Q?gEZ9yNe3k+cDzgHLyrylqi5l7Vm0MPrNvLPW1R+?= =?us-ascii?Q?5BCPnSvvYLrLOmwiWOAbqBs0cmC2=2F0QbrDA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95260 Subject: [ruby-core:95260] [Ruby master Feature#16244] Add a Time#before? and Time#after? method X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16244 has been reported by stevendaniels (Steven Daniels). ---------------------------------------- Feature #16244: Add a Time#before? and Time#after? method https://bugs.ruby-lang.org/issues/16244 * Author: stevendaniels (Steven Daniels) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Comparing times using `>` and`<` can be pretty confusing. I'd like to propose `Time#before?` and `Time#after?` methods for aliasing `Time#<` and `Time#>` These method aliases would make the code more readable. :) Current syntax: ``` ruby if current_time < expiration_at # do stuff end if birthday > thirteen_years_ago # you need a parent's permission to sign up end ``` What I'd like to see added: ``` ruby if current_time.before? expiration_at # do stuff end if birthday.after? thirteen_years_ago # you need a parent's permission to sign up end ``` Thanks for your consideration! -- https://bugs.ruby-lang.org/