diff --git a/lib/nanaimo/writer.rb b/lib/nanaimo/writer.rb index 9b21c23..256e8ed 100644 --- a/lib/nanaimo/writer.rb +++ b/lib/nanaimo/writer.rb @@ -90,7 +90,7 @@ def write_object(object) output end - QUOTED_STRING_REGEXP = %r{\A\z|[^\w\./]|\A___} + QUOTED_STRING_REGEXP = %r{\A\z|[^\w\.\$/]|\A___} private_constant :QUOTED_STRING_REGEXP def write_string_quoted_if_necessary(object) diff --git a/spec/nanaimo/writer_spec.rb b/spec/nanaimo/writer_spec.rb index d6a0a64..8734e09 100644 --- a/spec/nanaimo/writer_spec.rb +++ b/spec/nanaimo/writer_spec.rb @@ -80,6 +80,14 @@ def to_s expect(subject).to eq("#{utf8}Value /*A whimsical value*/\n") end end + + describe 'string with dollar sign' do + let(:root_object) { %($ABC) } + + it 'writes without quotes' do + expect(subject).to eq(%(#{utf8}$ABC\n)) + end + end end describe QuotedString do