Skip to content

Commit

Permalink
Prefer JSON generate to dump
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Sep 27, 2013
1 parent bd455c3 commit 5b940f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/execjs/external_runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def exec(source, options = {})
end

def call(identifier, *args)
eval "#{identifier}.apply(this, #{::JSON.dump(args)})"
eval "#{identifier}.apply(this, #{::JSON.generate(args)})"
end

protected
Expand All @@ -50,7 +50,7 @@ def compile(source)
end
output.sub!('#{encoded_source}') do
encoded_source = encode_unicode_codepoints(source)
::JSON.dump("(function(){ #{encoded_source} })()")
::JSON.generate("(function(){ #{encoded_source} })()", :quirks_mode => true)
end
output.sub!('#{json2_source}') do
IO.read(ExecJS.root + "/support/json2.js")
Expand Down

0 comments on commit 5b940f9

Please sign in to comment.