From: "alexdowad (Alex Dowad)" Date: 2012-06-12T19:09:02+09:00 Subject: [ruby-core:45582] [ruby-trunk - Bug #6578] (Ruby 1.9.2-p290) Built-in JSON library fails if "Parser" is defined at top level Issue #6578 has been updated by alexdowad (Alex Dowad). By the way, I haven't checked whether this works on Ruby 1.9.3... I am (sadly) stuck developing on Windows and can't install multiple versions of Ruby without RVM. ---------------------------------------- Bug #6578: (Ruby 1.9.2-p290) Built-in JSON library fails if "Parser" is defined at top level https://bugs.ruby-lang.org/issues/6578#change-27178 Author: alexdowad (Alex Dowad) Status: Open Priority: Normal Assignee: Category: Target version: 1.9.2 ruby -v: ruby 1.9.2p290 (2011-07-09) [i386-mingw32] To duplicate: class Parser end require 'json' The culprit is line 27 of common/json.rb: remove_const :Parser if const_defined? :Parser #const_defined? returns true even if Parser is defined at the top level, not within JSON. In this case, #remove_const fails with an exception. A possible fix would be: remove_const :Parser if constants.include? :Parser -- http://bugs.ruby-lang.org/