haraldb (Harald Böttiger)
- Login: haraldb
- Email: bottiger@live.com
- Registered on: 04/19/2015
- Last sign in: 04/20/2015
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 0 | 1 | 1 |
Activity
04/20/2015
-
03:35 PM Ruby Feature #11076: Enumerable method count_by
- Robert A. Heiler wrote:
> Can you also add a sentence or two for documentation? :-)
I am sorry but I am not sure to properly format this, but the documentation would be like:
Syntax:
group_by { |obj| block } → a_hash
...
04/19/2015
-
08:38 PM Ruby Feature #11076 (Closed): Enumerable method count_by
- I very often use `Hash[array.group_by{|x|x}.map{|x,y|[x,y.size]}]`.
Would be nice with to have a method called `count_by`:
~~~ruby
array = ['aa', 'aA', 'bb', 'cc']
p array.count_by(&:downcase) #=> {'aa'=>2,'bb'=>1,'cc'=>1}
~~~ -
08:30 PM Ruby Feature #11049: Enumerable#grep_v (inversed grep)
- Recursive Madman wrote:
> How about implementing `Regexp#invert` instead?
As grep using the case statement this would be ignoring a lot of cases that would be handy:
> array.invert_grep(Array) # Select all elements that are not ar...