Skip to content

Instantly share code, notes, and snippets.

Created March 10, 2010 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/327468 to your computer and use it in GitHub Desktop.
Save anonymous/327468 to your computer and use it in GitHub Desktop.
This my output_buffer that needs to be parsed and presented in a 3D Hash.
groupid fnam lname bday
1 abc xyz jan1
def lmn feb1
2 amy morgan may1
nick cary may6
Here is a sample code..
begin
test = Hash.new
test[port] = Hash.new
test[port].store(type, Hash.new)
mybuffer.each { |line|
groupid <- 1
fname <- 'abc'
lname <- 'xyz'
bday <- 'jan1'
test = {groupid=>{fnam=>{"lname"=>lname, "bday"=>bday}}}
}
puts " FINAL HASH-- #{test} "
end
--------> When I print the final hash; I get only the last line [ nick cary may6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment