summaryrefslogtreecommitdiff
path: root/lib/json
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json')
-rw-r--r--lib/json/pure/generator.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb
index d51316e..2b7eeb7 100644
--- a/lib/json/pure/generator.rb
+++ b/lib/json/pure/generator.rb
@@ -351,13 +351,13 @@ module JSON
def to_json(state = nil, *)
case
when infinite?
- if !state || state.allow_nan?
+ if state && state.allow_nan?
to_s
else
raise GeneratorError, "#{self} not allowed in JSON"
end
when nan?
- if !state || state.allow_nan?
+ if state && state.allow_nan?
to_s
else
raise GeneratorError, "#{self} not allowed in JSON"