Skip to content

JSON.load invoke the proc callback directly from the parser.#774

Merged
byroot merged 2 commits intoruby:masterfrom
casperisfine:on-parse-callback
Mar 27, 2025
Merged

JSON.load invoke the proc callback directly from the parser.#774
byroot merged 2 commits intoruby:masterfrom
casperisfine:on-parse-callback

Conversation

@casperisfine
Copy link
Copy Markdown

@casperisfine casperisfine commented Mar 26, 2025

And substitute the return value like Marshal.load doesm which I can only assume was the intent.

This also allows re-implement all the create_addition logic in json/common.rb, and open the door to extract it to another gem in the future.

@casperisfine casperisfine force-pushed the on-parse-callback branch 2 times, most recently from a488bed to 5b715b6 Compare March 27, 2025 11:44
And substitute the return value like `Marshal.load` doesm
which I can only assume was the intent.

This also open the door to re-implement all the `create_addition`
logic in `json/common.rb`.
@casperisfine casperisfine marked this pull request as ready for review March 27, 2025 11:54
@casperisfine casperisfine force-pushed the on-parse-callback branch 2 times, most recently from 68c25e9 to b37e6cf Compare March 27, 2025 12:14
By leveraging the `on_load` callback we can move all this logic
out of the parser. Which mean we no longer have to duplicate
that logic in both parser and that we'll later be able to extract
it entirely from the gem.
@byroot byroot merged commit 94f5df1 into ruby:master Mar 27, 2025
33 checks passed
@casperisfine casperisfine deleted the on-parse-callback branch March 27, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants