This repository was archived by the owner on Jul 23, 2025. It is now read-only.
Remove opportunistic loading of yajl/json_gem
#78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requiring
yajl/json_gem
causesJSON.parse
,JSON.generate
,#to_json
, and other built-in methods to be overridden with the faster YAJL implementation. Faster is, as a rule, better so this seems like a positive change overall. However, because this change extends outside ofgelf-rb
and impacts any place JSON is parsed or generated using the standard library interface, it can have surprising and unexpected consequences.When I updated gelf-rb to version 3.1.0, parts of my app started to behave differently. Specifically, U+2028 and U+2029 characters stopped being escaped within JSON strings. For a Rails app, which already overrides the standard library interface, this can be a problem [1]. (This will only impact folks who use YAJL without
require 'yajl/json_gem'
.)To remedy this,
yajl/json_gem
is no longer required by default. This makes the optimization of JSON parsing the responsibility of the app/script/person requiringgelf-rb
.[1] http://timelessrepo.com/json-isnt-a-javascript-subset