Ruby 2.0

Copy-pasted some internals from 2.0.0-p0 to get stuff working.