Skip to content

Commit 6204a55

Browse files
etiennebarriebyroot
andcommitted
Skip one allocation when there are no JSON options
Co-authored-by: Jean Boussier <[email protected]>
1 parent f575fca commit 6204a55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activesupport/lib/active_support/json/encoding.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class << self
3838
# ActiveSupport::JSON.encode({ key: "<>&" }, escape_html_entities: false)
3939
# # => "{\"key\":\"<>&\"}"
4040
def encode(value, options = nil)
41-
if options.nil?
41+
if options.nil? || options.empty?
4242
Encoding.encode_without_options(value)
4343
else
4444
Encoding.json_encoder.new(options).encode(value)

0 commit comments

Comments
 (0)