ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:70318] [Ruby trunk - Feature #11429] [Open] Local variable assignment Regex via ===
       [not found] <redmine.issue-11429.20150810204237@ruby-lang.org>
@ 2015-08-10 20:42 ` xovatdev
  2015-08-10 20:43 ` [ruby-core:70319] [Ruby trunk - Feature #11429] Local variable assignment via regex === xovatdev
  2015-08-10 23:26 ` [ruby-core:70321] " nobu
  2 siblings, 0 replies; 3+ messages in thread
From: xovatdev @ 2015-08-10 20:42 UTC (permalink / raw
  To: ruby-core

Issue #11429 has been reported by Sean Linsley.

----------------------------------------
Feature #11429: Local variable assignment Regex via === 
https://bugs.ruby-lang.org/issues/11429

* Author: Sean Linsley
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Currently, this assigns the `username` variable:

```
/(?<username>.*)@.*\..*/ =~ "seanlinsley@example.com"
```

But this does not:

```
/(?<username>.*)@.*\..*/ === "seanlinsley@example.com"
```

If it did, it would be possible to set variables during a case statement, which was my original goal:

```
case "seanlinsley@example.com"
when /(?<username>.*)@.*\..*/
  puts "Username is: #{username}"
end
```

I would be happy to implement this, if it's a desired feature.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:70319] [Ruby trunk - Feature #11429] Local variable assignment via regex ===
       [not found] <redmine.issue-11429.20150810204237@ruby-lang.org>
  2015-08-10 20:42 ` [ruby-core:70318] [Ruby trunk - Feature #11429] [Open] Local variable assignment Regex via === xovatdev
@ 2015-08-10 20:43 ` xovatdev
  2015-08-10 23:26 ` [ruby-core:70321] " nobu
  2 siblings, 0 replies; 3+ messages in thread
From: xovatdev @ 2015-08-10 20:43 UTC (permalink / raw
  To: ruby-core

Issue #11429 has been updated by Sean Linsley.

Subject changed from Local variable assignment Regex via ===  to Local variable assignment via regex === 

----------------------------------------
Feature #11429: Local variable assignment via regex === 
https://bugs.ruby-lang.org/issues/11429#change-53740

* Author: Sean Linsley
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Currently, this assigns the `username` variable:

```
/(?<username>.*)@.*\..*/ =~ "seanlinsley@example.com"
```

But this does not:

```
/(?<username>.*)@.*\..*/ === "seanlinsley@example.com"
```

If it did, it would be possible to set variables during a case statement, which was my original goal:

```
case "seanlinsley@example.com"
when /(?<username>.*)@.*\..*/
  puts "Username is: #{username}"
end
```

I would be happy to implement this, if it's a desired feature.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:70321] [Ruby trunk - Feature #11429] Local variable assignment via regex ===
       [not found] <redmine.issue-11429.20150810204237@ruby-lang.org>
  2015-08-10 20:42 ` [ruby-core:70318] [Ruby trunk - Feature #11429] [Open] Local variable assignment Regex via === xovatdev
  2015-08-10 20:43 ` [ruby-core:70319] [Ruby trunk - Feature #11429] Local variable assignment via regex === xovatdev
@ 2015-08-10 23:26 ` nobu
  2 siblings, 0 replies; 3+ messages in thread
From: nobu @ 2015-08-10 23:26 UTC (permalink / raw
  To: ruby-core

Issue #11429 has been updated by Nobuyoshi Nakada.

Description updated

They are different stories.

Enabling assignment via `Regexp#===` doesn't mean it via `when`.

----------------------------------------
Feature #11429: Local variable assignment via regex === 
https://bugs.ruby-lang.org/issues/11429#change-53741

* Author: Sean Linsley
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Currently, this assigns the `username` variable:

```ruby
/(?<username>.*)@.*\..*/ =~ "seanlinsley@example.com"
```

But this does not:

```ruby
/(?<username>.*)@.*\..*/ === "seanlinsley@example.com"
```

If it did, it would be possible to set variables during a case statement, which was my original goal:

```ruby
case "seanlinsley@example.com"
when /(?<username>.*)@.*\..*/
  puts "Username is: #{username}"
end
```

I would be happy to implement this, if it's a desired feature.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-10 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-11429.20150810204237@ruby-lang.org>
2015-08-10 20:42 ` [ruby-core:70318] [Ruby trunk - Feature #11429] [Open] Local variable assignment Regex via === xovatdev
2015-08-10 20:43 ` [ruby-core:70319] [Ruby trunk - Feature #11429] Local variable assignment via regex === xovatdev
2015-08-10 23:26 ` [ruby-core:70321] " nobu

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).