ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "rkh (Konstantin Haase)" <me@rkh.im>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:54664] [CommonRuby - Feature #8343][Open] StringScanner#[] should accept names of named captures
Date: Sun, 28 Apr 2013 23:46:35 +0900	[thread overview]
Message-ID: <redmine.issue-8343.20130428234634@ruby-lang.org> (raw)


Issue #8343 has been reported by rkh (Konstantin Haase).

----------------------------------------
Feature #8343: StringScanner#[] should accept names of named captures
https://bugs.ruby-lang.org/issues/8343

Author: rkh (Konstantin Haase)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Example:

    s = StringScanner.new("Fri Dec 12 1975 14:39")
    s.scan(/(?<wday>\w+) (?<month>\w+) (?<day>\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/

             reply	other threads:[~2013-04-28 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 14:46 rkh (Konstantin Haase) [this message]
2013-04-28 17:45 ` [ruby-core:54674] [CommonRuby - Feature #8343] StringScanner#[] should accept names of named captures rkh (Konstantin Haase)
2013-04-30  8:27 ` [ruby-core:54713] [CommonRuby - Feature #8343][Assigned] " naruse (Yui NARUSE)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-8343.20130428234634@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).