Permalink
Browse files

silenced "already initialized constant" warnings

  • Loading branch information...
1 parent b133845 commit 6fa828dca79cfa506d1b263241c641e407a73415 @flori flori committed with Sep 17, 2010
Showing with 5 additions and 2 deletions.
  1. +3 −0 lib/json/common.rb
  2. +1 −1 lib/json/ext.rb
  3. +1 −1 lib/json/pure.rb
View
@@ -49,6 +49,7 @@ def deep_const_get(path) # :nodoc:
# 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 @@ def generator=(generator) # :nodoc:
:object_nl => "\n",
:array_nl => "\n"
)
+ ensure
+ $VERBOSE = old
end
# Returns the JSON generator modul, that is used by JSON. This might be
View
@@ -11,5 +11,5 @@ module Ext
JSON.generator = Generator
end
- JSON_LOADED = true
+ JSON_LOADED = true unless const_defined?(:JSON_LOADED)
end
View
@@ -73,5 +73,5 @@ module Pure
JSON.generator = Generator
end
- JSON_LOADED = true
+ JSON_LOADED = true unless const_defined?(:JSON_LOADED)
end

2 comments on commit 6fa828d

@jfirebaugh

Is this in any released version?

@mernen
Owner
mernen commented on 6fa828d Oct 26, 2010

No, last version was 1.4.6, released back in August. This gem is just kept in sync with json, and it's up to Florian to release it.

Please sign in to comment.