Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 11th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. is there a method to move 'up' a Hash tree in ruby?
  2. dat = {
  3.     'building' => {'street' => 'High Street 10', 'people' =>[Person, Person]}
  4. }
  5.        
  6. def info with_root = false
  7.       with_root ? dat : dat['building']
  8.     end #info
  9.        
  10. addr = {'street' => 'High Street 10', 'people' =>[Person, Person]}
  11.  dat1 = {'building' => addr}
  12.  dat2 = {'zip'=>55117, 'electricBillID'=>11223344, 'address' => addr