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


Groups > comp.lang.ruby > #3362

Can I append hash to hashes?

From Siratinee Sukachai <ploy.sukachai@gmail.com>
Newsgroups comp.lang.ruby
Subject Can I append hash to hashes?
Date 2011-04-22 02:22 -0500
Organization Service de news de lacave.net
Message-ID <3d3ff00fedc9442b82823de5ba1d77ae@ruby-forum.com> (permalink)

Show all headers | View raw


I need to do a hash some kind like this:
Member => {email => Email, name => Name, lastname => Lastname}

But I get a hash in foreach loop so I need to append a hash to hashes.
e.g.
First round: Member => {email => Email}
Second round: Member => {email => Email, name => Name}
Third round: Member => {email => Email, name => Name, lastname =>
Lastname}

Can I do that and how?
In my case I cannot do the array because I need to use this hash to
generate yaml later.
If I do as the array, the formatting what I get in yaml is not what I
need.
Pls help...

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

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


Thread

Can I append hash to hashes? Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-22 02:22 -0500
  Re: Can I append hash to hashes? Giampiero Zanchi <cidza@tin.it> - 2011-04-22 02:40 -0500
  Re: Can I append hash to hashes? Quintus <sutniuq@gmx.net> - 2011-04-22 02:53 -0500
    Re: Can I append hash to hashes? Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-22 03:13 -0500
      Re: Can I append hash to hashes? Robert Dober <robert.dober@gmail.com> - 2011-04-22 04:07 -0500
  Re: Can I append hash to hashes? Siratinee Sukachai <ploy.sukachai@gmail.com> - 2011-04-22 05:43 -0500

csiph-web