Can someone please explain the semantics behind the following:

irb(main):001:0> a = ( 4 + 5 )
=> 9
irb(main):002:0> a = ( 4
irb(main):003:1>       + 5 )
=> 5
irb(main):004:0> a = ( 4 +
irb(main):005:1*       5 )
=> 9

The first and last statements make sense to me, but why is the second one
returning 5?

I find semantics like this troubling, and no documentation sheds light as
to what would cause this behavior.

Thanks,
Almann