Skip to content

Commit

Permalink
Merge pull request #124 from liepa/fix_dumping_of_escaped_global_vari…
Browse files Browse the repository at this point in the history
…able_interpolation

Fix dumping of #$
  • Loading branch information
emancu authored Nov 18, 2019
2 parents 0c1b9ca + ca5bf95 commit 2c681ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/toml-rb/dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def to_toml(obj)
elsif obj.is_a? Regexp
obj.inspect.inspect
elsif obj.is_a? String
obj.inspect.gsub(/\\(#[@{])/, '\1')
obj.inspect.gsub(/\\(#[$@{])/, '\1')
else
obj.inspect
end
Expand Down
6 changes: 6 additions & 0 deletions test/dumper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,10 @@ def test_dump_interpolation_at
dumped = TomlRB.dump(hash)
assert_equal 'key = "includes #@variable"' + "\n", dumped
end

def test_dump_interpolation_dollar
hash = { "key" => 'includes #$variable' }
dumped = TomlRB.dump(hash)
assert_equal 'key = "includes #$variable"' + "\n", dumped
end
end

0 comments on commit 2c681ec

Please sign in to comment.