diff options
-rw-r--r-- | ext/json/lib/json/common.rb | 45 |
1 files changed, 23 insertions, 22 deletions
@@ -74,15 +74,6 @@ module JSON $VERBOSE = old end - def create_pretty_state - State.new( - :indent => ' ', - :space => ' ', - :object_nl => "\n", - :array_nl => "\n" - ) - end - # Returns the JSON generator module that is used by JSON. attr_reader :generator @@ -366,6 +357,14 @@ module JSON generate(obj, opts) end # :call-seq: # JSON.pretty_generate(obj, opts = nil) -> new_string # @@ -397,22 +396,24 @@ module JSON # } # def pretty_generate(obj, opts = nil) - if State === opts - state, opts = opts, nil - else - state = JSON.create_pretty_state - end if opts - if opts.respond_to? :to_hash - opts = opts.to_hash - elsif opts.respond_to? :to_h - opts = opts.to_h - else - raise TypeError, "can't convert #{opts.class} into Hash" end - state.configure(opts) end - state.generate(obj) end # Sets or returns default options for the JSON.unsafe_load method. |