I'm getting some very strange behavior from a conditional statement --
I can;t imagine how it is happeneing and I wondering if I stumbled upon
some sort of bug in Ruby. Although I have no idea how it could even
occuer, perhaps someone else can see it. Here's the code:

  p pkg
  p pkg.gem
  p pkg.gem
  if pkg.gem
      p "HERE"
      pkg = pkg.__merge__( pkg.gem )
  end
  p pkg

This prints

  #<OpenObject....>
  nil
  nil
  nil

Notice it does not print "HERE" yet by that last print pkg has somehow
become nil! Note that I repeated 'p pkg.gem' to show that it has
nothing to do with calling this statment. Now if I remark out the pkg
assignment:

  p pkg
  p pkg.gem
  p pkg.gem
  if pkg.gem
      p "HERE"
      #pkg = pkg.__merge__( pkg.gem )
  end
  p pkg

I get

  #<OpenObject....>
  nil
  nil
  #<OpenObject....>

As it should be. How is this possible?

FYI
Ubuntu Linux
ruby 1.8.4 (2005-12-24) [i486-linux]

Thanks,
T.