* [ruby-core:54160] [ruby-trunk - Feature #8246][Open] Hash#traverse
@ 2013-04-10 23:03 zzak (Zachary Scott)
2013-04-10 23:46 ` [ruby-core:54161] [ruby-trunk - Feature #8246] Hash#traverse marcandre (Marc-Andre Lafortune)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: zzak (Zachary Scott) @ 2013-04-10 23:03 UTC (permalink / raw
To: ruby-core
Issue #8246 has been reported by zzak (Zachary Scott).
----------------------------------------
Feature #8246: Hash#traverse
https://bugs.ruby-lang.org/issues/8246
Author: zzak (Zachary Scott)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
=begin
From ((<GH-275|URL:https://github.com/ruby/ruby/pull/275>))
Traverses the given levels of a hash and returns the value associated with the
last key provided. Allows for concise access for deeply nested hashes - often encountered with dealing with external restful apis.
(({hash = { level1: { level2: { level3: 3 } } }}))
(({hash.traverse :level1, :level2, :level3 #=> 3}))
Also supports a default value block if the value is nil or the key is
not found.
(({hash.traverse(:level1, :level2, :non_existent_key) { 5 } #=> 5}))
=end
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:54161] [ruby-trunk - Feature #8246] Hash#traverse
2013-04-10 23:03 [ruby-core:54160] [ruby-trunk - Feature #8246][Open] Hash#traverse zzak (Zachary Scott)
@ 2013-04-10 23:46 ` marcandre (Marc-Andre Lafortune)
2013-04-11 20:00 ` [ruby-core:54197] " headius (Charles Nutter)
2014-10-13 20:47 ` [ruby-core:65686] [ruby-trunk - Feature #8246] [Closed] Hash#traverse e
2 siblings, 0 replies; 4+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-04-10 23:46 UTC (permalink / raw
To: ruby-core
Issue #8246 has been updated by marcandre (Marc-Andre Lafortune).
Assignee set to matz (Yukihiro Matsumoto)
Priority changed from Normal to Low
Marking as duplicate of #5531.
It's also related to #8237 because one could envision something like:
hash[:level1]??.[:level2]??.[:non_existent_key] || 5
----------------------------------------
Feature #8246: Hash#traverse
https://bugs.ruby-lang.org/issues/8246#change-38419
Author: zzak (Zachary Scott)
Status: Open
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version:
=begin
From ((<GH-275|URL:https://github.com/ruby/ruby/pull/275>))
Traverses the given levels of a hash and returns the value associated with the
last key provided. Allows for concise access for deeply nested hashes - often encountered with dealing with external restful apis.
(({hash = { level1: { level2: { level3: 3 } } }}))
(({hash.traverse :level1, :level2, :level3 #=> 3}))
Also supports a default value block if the value is nil or the key is
not found.
(({hash.traverse(:level1, :level2, :non_existent_key) { 5 } #=> 5}))
=end
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:54197] [ruby-trunk - Feature #8246] Hash#traverse
2013-04-10 23:03 [ruby-core:54160] [ruby-trunk - Feature #8246][Open] Hash#traverse zzak (Zachary Scott)
2013-04-10 23:46 ` [ruby-core:54161] [ruby-trunk - Feature #8246] Hash#traverse marcandre (Marc-Andre Lafortune)
@ 2013-04-11 20:00 ` headius (Charles Nutter)
2014-10-13 20:47 ` [ruby-core:65686] [ruby-trunk - Feature #8246] [Closed] Hash#traverse e
2 siblings, 0 replies; 4+ messages in thread
From: headius (Charles Nutter) @ 2013-04-11 20:00 UTC (permalink / raw
To: ruby-core
Issue #8246 has been updated by headius (Charles Nutter).
As a feature that affects all Ruby implementations, this should probably move to CommonRuby: https://bugs.ruby-lang.org/projects/common-ruby
----------------------------------------
Feature #8246: Hash#traverse
https://bugs.ruby-lang.org/issues/8246#change-38475
Author: zzak (Zachary Scott)
Status: Open
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version:
=begin
From ((<GH-275|URL:https://github.com/ruby/ruby/pull/275>))
Traverses the given levels of a hash and returns the value associated with the
last key provided. Allows for concise access for deeply nested hashes - often encountered with dealing with external restful apis.
(({hash = { level1: { level2: { level3: 3 } } }}))
(({hash.traverse :level1, :level2, :level3 #=> 3}))
Also supports a default value block if the value is nil or the key is
not found.
(({hash.traverse(:level1, :level2, :non_existent_key) { 5 } #=> 5}))
=end
--
http://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:65686] [ruby-trunk - Feature #8246] [Closed] Hash#traverse
2013-04-10 23:03 [ruby-core:54160] [ruby-trunk - Feature #8246][Open] Hash#traverse zzak (Zachary Scott)
2013-04-10 23:46 ` [ruby-core:54161] [ruby-trunk - Feature #8246] Hash#traverse marcandre (Marc-Andre Lafortune)
2013-04-11 20:00 ` [ruby-core:54197] " headius (Charles Nutter)
@ 2014-10-13 20:47 ` e
2 siblings, 0 replies; 4+ messages in thread
From: e @ 2014-10-13 20:47 UTC (permalink / raw
To: ruby-core
Issue #8246 has been updated by Zachary Scott.
Status changed from Open to Closed
Priority changed from Low to Normal
Yeah, sorry, this is a duplicate of #5531 with just a different method name
----------------------------------------
Feature #8246: Hash#traverse
https://bugs.ruby-lang.org/issues/8246#change-49417
* Author: Zachary Scott
* Status: Closed
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: core
* Target version:
----------------------------------------
=begin
From ((<GH-275|URL:https://github.com/ruby/ruby/pull/275>))
Traverses the given levels of a hash and returns the value associated with the
last key provided. Allows for concise access for deeply nested hashes - often encountered with dealing with external restful apis.
(({hash = { level1: { level2: { level3: 3 } } }}))
(({hash.traverse :level1, :level2, :level3 #=> 3}))
Also supports a default value block if the value is nil or the key is
not found.
(({hash.traverse(:level1, :level2, :non_existent_key) { 5 } #=> 5}))
=end
---Files--------------------------------
275.patch (3.05 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-13 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 23:03 [ruby-core:54160] [ruby-trunk - Feature #8246][Open] Hash#traverse zzak (Zachary Scott)
2013-04-10 23:46 ` [ruby-core:54161] [ruby-trunk - Feature #8246] Hash#traverse marcandre (Marc-Andre Lafortune)
2013-04-11 20:00 ` [ruby-core:54197] " headius (Charles Nutter)
2014-10-13 20:47 ` [ruby-core:65686] [ruby-trunk - Feature #8246] [Closed] Hash#traverse e
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).