Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3398

Re: Recursive to check same key in has

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: Recursive to check same key in has
Date 2011-04-23 07:20 -0500
Organization Service de news de lacave.net
Message-ID <920f4f632df8ad81f125de63f3ed8483@ruby-forum.com> (permalink)
References <368cef391ff38f27093984a8ae8f8375@ruby-forum.com>

Show all headers | View raw


This is a case where recursion may be helpful.

However, based on your other posting, I think you may be trying to solve 
the wrong problem.

If you're trying to combine

project.opp.Index.title=Opportunities
project.opp.Index.link=Report

into a single nested hash, then you don't need to build separate nested 
hashes and then combine them. I think it would be easier to build the 
final hash up-front, as you read in each new line.

Of course, doing a deep-merge of a nested hash structure is an 
interesting exercise, or homework problem :-)

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Recursive to check same key in has Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-23 06:43 -0500
  Re: Recursive to check same key in has Brian Candler <b.candler@pobox.com> - 2011-04-23 07:20 -0500

csiph-web