Forum: Ruby-core [ruby-trunk - Feature #8951][Open] Please add a hash-to-hash alternative of the map method to Hash

80b1b9758e76568747b2c50bcb911201?d=identicon&s=25 behrangsa (Behrang Saeedzadeh) (Guest)
on 2013-09-25 06:05
(Received via mailing list)
Issue #8951 has been reported by behrangsa (Behrang Saeedzadeh).

----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951

Author: behrangsa (Behrang Saeedzadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Please see this thread:
https://twitter.com/behrangsa/status/382670159086776323
22e767367fe9c51fc5d22af7a631c424?d=identicon&s=25 Fuad Saud (Guest)
on 2013-09-25 06:07
(Received via mailing list)
Wow, I missed this a couple of days ago. Totally supported.

--
Fuad Saud
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
93ea804680a6e7fb9d1914078833da51?d=identicon&s=25 jamonholmgren (Jamon Holmgren) (Guest)
on 2013-09-25 06:36
(Received via mailing list)
Issue #8951 has been updated by jamonholmgren (Jamon Holmgren).


How about:

`Hash#graph`

or

`Hash#rehash`

----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951#change-41971

Author: behrangsa (Behrang Saeedzadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Please see this thread:
https://twitter.com/behrangsa/status/382670159086776323
22e767367fe9c51fc5d22af7a631c424?d=identicon&s=25 Fuad Saud (Guest)
on 2013-09-25 07:15
(Received via mailing list)
#rehash is taken:
http://www.ruby-doc.org/core-2.0.0/Hash.html#method-i-rehash

I was thinking about 'projection' or something, but everything feels
just like an alternative to 'map' (#map, in my opinion, should return a
hash).

--
Fuad Saud
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
Df9d48b6e2ae6cdedf4c39c2e58df851?d=identicon&s=25 boris_stitnicky (Boris Stitnicky) (Guest)
on 2013-09-26 02:08
(Received via mailing list)
Issue #8951 has been updated by boris_stitnicky (Boris Stitnicky).


In my private library, I have 3 map-like methods defined on hash:

```
Hash#with_keys
Hash#with_values
Hash#modify
```
----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951#change-41980

Author: behrangsa (Behrang Saeedzadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Please see this thread:
https://twitter.com/behrangsa/status/382670159086776323
80b1b9758e76568747b2c50bcb911201?d=identicon&s=25 behrangsa (Behrang Saeedzadeh) (Guest)
on 2013-10-13 15:12
(Received via mailing list)
Issue #8951 has been updated by behrangsa (Behrang Saeedzadeh).


How about having a construct similar to `map.with_index`? For example
`map.to_has` or `map.hashify`:

```
hash = { ... }
hash.map.to_hash do |e|
 convert(e)
end
```

or

```
hash = { ... }
hash.map.hashify do |e|
 convert(e)
end
```
----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951#change-42438

Author: behrangsa (Behrang Saeedzadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Please see this thread:
https://twitter.com/behrangsa/status/382670159086776323
22e767367fe9c51fc5d22af7a631c424?d=identicon&s=25 fuadksd (Fuad Saud) (Guest)
on 2013-12-03 03:10
(Received via mailing list)
Issue #8951 has been updated by fuadksd (Fuad Saud).


Hash#transform might also be a good name.
----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951#change-43377

Author: behrangsa (Behrang Saeedzadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Please see this thread:
https://twitter.com/behrangsa/status/382670159086776323
5c9d0ecbe3045579b72f96744c62735c?d=identicon&s=25 unknown (Guest)
on 2014-06-16 17:29
(Received via mailing list)
Issue #8951 has been updated by Andrew M.


I believe this is a duplicate of #6669

----------------------------------------
Feature #8951: Please add a hash-to-hash alternative of the map method
to Hash
https://bugs.ruby-lang.org/issues/8951#change-47241

* Author: Behrang Saeedzadeh
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
This topic is locked and can not be replied to.