-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent loading both
json/ext
and json/pure
Fix: #650 Ref: #646 `json_pure` currently doesn't work well at all because `json/ext` is a default gem, so if you have code requiring `json/pure` and some other code requiring `json`, you end up with both loaded. If the `json` and `json_pure` versions match, it's not too bad, but if they don't match, you might run into issues with private APIs no longer matching.
- Loading branch information
Showing
10 changed files
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
begin | ||
require 'rubygems/package_task' | ||
rescue LoadError | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#frozen_string_literal: true | ||
|
||
require 'json/version' | ||
|
||
module JSON | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
begin | ||
require 'ostruct' | ||
rescue LoadError | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'json/common' | ||
|
||
module JSON | ||
# This module holds all the modules/classes that implement JSON's | ||
# functionality in pure ruby. | ||
module Pure | ||
require 'json/pure/parser' | ||
require 'json/pure/generator' | ||
$DEBUG and warn "Using Pure library for JSON." | ||
JSON.parser = Parser | ||
JSON.generator = Generator | ||
end | ||
unless defined?(::JSON::JSON_LOADED) | ||
require 'json/pure/parser' | ||
require 'json/pure/generator' | ||
$LOADED_FEATURES << File.expand_path("../ext.rb", __FILE__) | ||
$DEBUG and warn "Using Pure library for JSON." | ||
JSON.parser = JSON::Pure::Parser | ||
JSON.generator = JSON::Pure::Generator | ||
|
||
JSON_LOADED = true unless defined?(::JSON::JSON_LOADED) | ||
JSON::JSON_LOADED = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'json/pure' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters