Skip to content

Commit

Permalink
Do not escape quotes when string is interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
tlopo committed Feb 24, 2020
1 parent a5868c7 commit c924214
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: ruby
rvm:
- "2.5.0"
- "2.6.0"
sudo: false
cache: bundler
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tfdsl (0.1.5)
tfdsl (0.1.6)

GEM
remote: https://rubygems.org/
Expand Down
3 changes: 3 additions & 0 deletions lib/tfdsl/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def safe_multiline(str)
end

def safe_quote(str)
# Don't escape when string is interpolation
return str if str =~ /^\s*\$\{/

str.gsub(/([^\\])"/, '\1\"').gsub(/([^\\])"/, '\1\"')
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tfdsl/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TFDSL
VERSION = '0.1.5'.freeze
VERSION = '0.1.6'.freeze
end

0 comments on commit c924214

Please sign in to comment.