You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
ruby: 3.2.3
json_pure: 2.7.1
../.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/json_pure-2.7.1/lib/json/pure/generator.rb:320:in `to_json': undefined method `strict?' for {}:Hash (NoMethodError)
if generator_state.strict?
^^^^^^^^
from pure_json.rb:14:in `<main>'
Fix
I think this would do the trick, but I'm not sur I understand why it is written that way today...
diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb
index c85222c..d7f86a3 100644
--- a/lib/json/pure/generator.rb+++ b/lib/json/pure/generator.rb@@ -316,8 +316,8 @@ module JSON
# Converts this object to a string (calling #to_s), converts
# it to a JSON string, and returns the result. This is a fallback, if no
# special method #to_json was defined for some object.
- def to_json(generator_state)- if generator_state.strict?+ def to_json(state = nil, *)+ if State.from_state(state).strict?
raise GeneratorError, "#{self.class} not allowed in JSON"
else
to_s.to_json
The text was updated successfully, but these errors were encountered:
Summary
The commit f65f2282 introduced a change in the
to_json
method that breaksTime.to_json
.Reproduction
Fix
I think this would do the trick, but I'm not sur I understand why it is written that way today...
The text was updated successfully, but these errors were encountered: