summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2010-09-17 20:04:16 +0200
committerFlorian Frank <flori@ping.de>2010-09-17 20:04:16 +0200
commit2c0f8d2c9b15a33b8d10ffcb1959aef54d320b57 (patch)
tree6183419a16ae85decfccd7871a5e3097d1bed2b5
parentdb3dc79e33c584f8bad89d08549f507a5d27fb5f (diff)
downloadjson-2c0f8d2c9b15a33b8d10ffcb1959aef54d320b57.tar.gz
silenced "already initialized constant" warnings
-rw-r--r--lib/json/common.rb3
-rw-r--r--lib/json/ext.rb2
-rw-r--r--lib/json/pure.rb2
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/json/common.rb b/lib/json/common.rb
index 1c91672..d5444b9 100644
--- a/lib/json/common.rb
+++ b/lib/json/common.rb
@@ -49,6 +49,7 @@ module JSON
# Set the module _generator_ to be used by JSON.
def generator=(generator) # :nodoc:
+ old, $VERBOSE = $VERBOSE, nil
@generator = generator
generator_methods = generator::GeneratorMethods
for const in generator_methods.constants
@@ -77,6 +78,8 @@ module JSON
:object_nl => "\n",
:array_nl => "\n"
)
+ ensure
+ $VERBOSE = old
end
# Returns the JSON generator modul, that is used by JSON. This might be
diff --git a/lib/json/ext.rb b/lib/json/ext.rb
index a6b353d..a5e3148 100644
--- a/lib/json/ext.rb
+++ b/lib/json/ext.rb
@@ -11,5 +11,5 @@ module JSON
JSON.generator = Generator
end
- JSON_LOADED = true
+ JSON_LOADED = true unless const_defined?(:JSON_LOADED)
end
diff --git a/lib/json/pure.rb b/lib/json/pure.rb
index 1848f03..08efa83 100644
--- a/lib/json/pure.rb
+++ b/lib/json/pure.rb
@@ -73,5 +73,5 @@ module JSON
JSON.generator = Generator
end
- JSON_LOADED = true
+ JSON_LOADED = true unless const_defined?(:JSON_LOADED)
end