From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 0FFE217CF278 for ; Tue, 30 Apr 2013 17:51:37 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 1A44BEA6BDD for ; Tue, 30 Apr 2013 17:27:42 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 358B697A827 for ; Tue, 30 Apr 2013 17:27:42 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tog2byKLVxmY for ; Tue, 30 Apr 2013 17:27:42 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 1471497A820 for ; Tue, 30 Apr 2013 17:27:42 +0900 (JST) Received: from carbon.ruby-lang.org (carbon.ruby-lang.org [221.186.184.68]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id B29AC95241F for ; Tue, 30 Apr 2013 17:27:39 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by carbon.ruby-lang.org (Postfix) with ESMTP id 4F87C3C2294D3; Tue, 30 Apr 2013 17:27:32 +0900 (JST) Received: from fluorine.ruby-lang.org (www.rubyist.net [210.251.121.216]) by carbon.ruby-lang.org (Postfix) with ESMTP id 852D23C2294C7 for ; Tue, 30 Apr 2013 17:27:31 +0900 (JST) Received: from ruby-lang.org (localhost [127.0.0.1]) by fluorine.ruby-lang.org (Postfix) with ESMTP id 74DEF3F439 for ; Tue, 30 Apr 2013 17:27:28 +0900 (JST) Delivered-To: ruby-core@ruby-lang.org Date: Tue, 30 Apr 2013 17:27:31 +0900 Posted: Tue, 30 Apr 2013 17:27:28 +0900 From: "naruse (Yui NARUSE)" Reply-To: ruby-core@ruby-lang.org Subject: [ruby-core:54713] [CommonRuby - Feature #8343][Assigned] StringScanner#[] should accept names of named captures To: ruby-core@ruby-lang.org Message-Id: References: X-ML-Name: ruby-core X-Mail-Count: 54713 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-core-ctl@ruby-lang.org; help= X-Mailer: Redmine X-Redmine-Issue-Author: rkh X-Redmine-Issue-Assignee: naruse X-Auto-Response-Suppress: OOF X-Redmine-Issue-Id: 8343 X-Redmine-Mailinglistintegration-Message-Ids: 27964 X-Redmine-Project: common-ruby Auto-Submitted: auto-generated X-Redmine-Site: Ruby Issue Tracking System X-Redmine-Host: bugs.ruby-lang.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Precedence: bulk List-Id: ruby-core.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: Issue #8343 has been updated by naruse (Yui NARUSE). Status changed from Open to Assigned Assignee set to naruse (Yui NARUSE) rkh (Konstantin Haase) wrote: > On a related note: should the patch be submitted in a second issue on the ruby-trunk project? Here is also correct place now. I'll merge this if there are no objection. ---------------------------------------- Feature #8343: StringScanner#[] should accept names of named captures https://bugs.ruby-lang.org/issues/8343#change-39059 Author: rkh (Konstantin Haase) Status: Assigned Priority: Normal Assignee: naruse (Yui NARUSE) Category: Target version: Example: s = StringScanner.new("Fri Dec 12 1975 14:39") s.scan(/(?\w+) (?\w+) (?\d+) /) # this currently works s[0] # -> "Fri Dec 12 " s[1] # -> "Fri" s[2] # -> "Dec" s[3] # -> "12" # this currently does not work s[:wday] # -> "Fri" s[:month] # -> "Dec" s[:day] # -> "12" I attached a patch including tests for MRI, I don't know if Rubinius has a different implementation, I guess JRuby has. I can look into this if the feature gets accepted. -- http://bugs.ruby-lang.org/