/Users/jwebb/src/bigjason/elster/lib/elster/streamer.rb in elster-0.0.5 vs /Users/jwebb/src/bigjason/elster/lib/elster/streamer.rb in elster-0.0.6

- old
+ new

@@ -125,11 +125,12 @@ def encode_generic(value) MultiJson.dump(value) end + SAFE_RE = Regexp.new("\\A[#{Regexp.escape((32..126).select{|c| c != 34}.map{|c| c.chr}.join)}]+\\z") def encode_string(value) - if value =~ /\A[\w\d \t]+\Z/ + if value =~ SAFE_RE "\"#{value}\"" else encode_generic(value.to_s) end end