Skip to content

Commit

Permalink
Prefer String#inspect to private API
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Aug 22, 2022
1 parent 530337d commit 0e80d3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,10 @@
},
},
match: [
' log_format format1 \'FORMAT1\';',
' log_format format2 \'FORMAT2\';',
' log_format format3 \'FORMAT3\';',
' log_format format4 escape=json \'{"response": $status, "verb": "$request_method"}\';'
' log_format format1 "FORMAT1";',
' log_format format2 "FORMAT2";',
' log_format format3 "FORMAT3";',
' log_format format4 escape=json "{\\"response\\": $status, \\"verb\\": \\"$request_method\\"}";'
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ http {
<% if @log_format -%>
<% @log_format.sort_by{|k,v| k}.each do |key,value| -%>
<%- if value.is_a?(String) -%>
log_format <%= key %> <%= Puppet::Pops::Types::StringConverter.convert(value, '%p') %>;
log_format <%= key %> <%= value.inspect %>;
<%- else -%>
log_format <%= key %> <%= "escape=#{value['escape']} " if value['escape'] %><%= Puppet::Pops::Types::StringConverter.convert(value['format'], '%p') %>;
log_format <%= key %> <%= "escape=#{value['escape']} " if value['escape'] %><%= value['format'].inspect %>;
<%- end -%>
<% end -%>
<% end -%>
Expand Down

0 comments on commit 0e80d3e

Please sign in to comment.