summaryrefslogtreecommitdiff
path: root/ext/json/lib
diff options
context:
space:
mode:
authorÉtienne Barrié <[email protected]>2024-12-16 12:25:48 +0100
committerHiroshi SHIBATA <[email protected]>2025-01-28 15:41:47 +0900
commit89e316ad06f28f473030da04f33711328dc143c5 ()
treee4cb2ae7b487c195576f58b835ad0f91191d4098 /ext/json/lib
parent53cf2170f9fb1b2686ba3927609833a821c64b46 (diff)
Introduce JSON::Coder
Co-authored-by: Jean Boussier <[email protected]>
-rw-r--r--ext/json/lib/json/common.rb87
-rw-r--r--ext/json/lib/json/ext/generator/state.rb1
2 files changed, 88 insertions, 0 deletions
@@ -174,7 +174,18 @@ module JSON
# This allows to easily assemble multiple JSON fragments that have
# been peristed somewhere without having to parse them nor resorting
# to string interpolation.
Fragment = Struct.new(:json) do
def to_json(state = nil, *)
json
end
@@ -851,6 +862,82 @@ module JSON
class << self
private :merge_dump_options
end
end
module ::Kernel
@@ -58,6 +58,7 @@ module JSON
space_before: space_before,
object_nl: object_nl,
array_nl: array_nl,
allow_nan: allow_nan?,
ascii_only: ascii_only?,
max_nesting: max_nesting,