[#68137] improve semantics of manpages — "Anthony J. Bentley" <anthony@...>
Hi,
1 message
2015/02/17
[#68144] Re: Future of test suites for Ruby — Anthony Crumley <anthony.crumley@...>
FYI...
4 messages
2015/02/17
[#68343] [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault? — ruby@...
Issue #10916 has been reported by why do i need this acct just to create a bug report.
5 messages
2015/02/27
[#68373] Re: [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault?
— "Martin J. Dürst" <duerst@...>
2015/03/02
> * Author: why do i need this acct just to create a bug report
[#68358] [Ruby trunk - Bug #10902] require("enumerator") scans LOAD_PATH 2x on every invocation — ruby@...1.net
Issue #10902 has been updated by Aman Gupta.
3 messages
2015/02/28
[ruby-core:68014] [CommonRuby - Feature #10829] Add to_proc method to the Array class
From:
ben@...
Date:
2015-02-04 23:01:00 UTC
List:
ruby-core #68014
Issue #10829 has been updated by Ben Morgan.
Update example code, there was a missing `&`:
```ruby
[1, 2, 3, 4, 5].map(&[:+, 3])
# => [4, 5, 6, 7, 8]
```
----------------------------------------
Feature #10829: Add to_proc method to the Array class
https://bugs.ruby-lang.org/issues/10829#change-51401
* Author: Ben Morgan
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
In ruby, we've all seen this shortcut:
```ruby
user.posts.map(&:title)
```
The expanded version is:
```ruby
user.posts.map { |post| post.title }
```
Sometimes, however, that method might take arguments. This feature proposal is to allow the `to_proc` shortcut to be able to respond to the `Array` class. This would allow developers to be able to use the shortcut to be able to pass in arguments. This can currently be done by reopening the `Array` class and supplying it with a `to_proc` method:
```ruby
class Array
def to_proc
proc { |receiver| receiver.send *self }
end
end
```
This would allow this code to be able to run:
```ruby
[1, 2, 3, 4, 5].map([:+, 3])
# => [4, 5, 6, 7, 8]
```
--
https://bugs.ruby-lang.org/