diff options
-rw-r--r-- | lib/chef/json_compat.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/chef/json_compat.rb b/lib/chef/json_compat.rb index f545c71373..b5c9072f6f 100644 --- a/lib/chef/json_compat.rb +++ b/lib/chef/json_compat.rb @@ -53,10 +53,8 @@ class Chef end def to_json_pretty(obj, opts = nil) - opts ||= {} - options_map = {} - options_map[:pretty] = true - options_map[:indent] = opts[:indent] if opts.key?(:indent) + options_map = { pretty: true } + options_map[:indent] = opts[:indent] if opts.respond_to?(:key?) && opts.key?(:indent) to_json(obj, options_map).chomp end |