Skip to content

Commit 3d741e8

Browse files
author
Cody Horton
committed
fix for pretty_generate throwing wrong number of arguments error
1 parent 3226913 commit 3d741e8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Unreleased
44

5+
* Fix for JSON.pretty_generate to use passed state object's generate instead of state class as the required parameters aren't available.
6+
57
### 2025-05-12 (2.12.0)
68

79
* Improve floating point generation to not use scientific notation as much.

lib/json/common.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def fast_generate(obj, opts = nil)
490490
# }
491491
#
492492
def pretty_generate(obj, opts = nil)
493-
return state.generate(obj) if State === opts
493+
return opts.generate(obj) if State === opts
494494

495495
options = PRETTY_GENERATE_OPTIONS
496496

0 commit comments

Comments
 (0)