@@ -611,7 +611,7 @@ class << self
611
611
# puts File.read(path)
612
612
# Output:
613
613
# {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
614
- def dump ( obj , anIO = nil , limit = nil , strict : NOT_SET )
614
+ def dump ( obj , anIO = nil , limit = nil , kwargs = nil )
615
615
if anIO and limit . nil?
616
616
anIO = anIO . to_io if anIO . respond_to? ( :to_io )
617
617
unless anIO . respond_to? ( :write )
@@ -621,7 +621,7 @@ def dump(obj, anIO = nil, limit = nil, strict: NOT_SET)
621
621
end
622
622
opts = JSON . dump_default_options
623
623
opts = opts . merge ( :max_nesting => limit ) if limit
624
- opts [ :strict ] = strict if NOT_SET != strict
624
+ merge_dump_options ( opts , ** kwargs ) if kwargs
625
625
result = generate ( obj , opts )
626
626
if anIO
627
627
anIO . write result
@@ -637,6 +637,12 @@ def dump(obj, anIO = nil, limit = nil, strict: NOT_SET)
637
637
def self . iconv ( to , from , string )
638
638
string . encode ( to , from )
639
639
end
640
+
641
+ private
642
+
643
+ def merge_dump_options ( opts , strict : NOT_SET )
644
+ opts [ :strict ] = strict if NOT_SET != strict
645
+ end
640
646
end
641
647
642
648
module ::Kernel
0 commit comments