Fix Readline check on Ruby 1.8.7

`Kernel.const_defined?` will return true for root-level constants in Ruby
1.9+, but false in Ruby 1.8. `Object.const_defined?` works consistently in
all versions.