Permalink
Browse files

Merge branch 'jlxw-patch-2'

Closes #9184
  • Loading branch information...
rafaelfranca committed Mar 23, 2013
2 parents 31388fa + 2c93048 commit e96fa8987b0a2c21604c0b5aeb78bedfac5e1faa
@@ -30,8 +30,8 @@ def string_to_hstore(string)
nil
elsif String === string
Hash[string.scan(HstorePair).map { |k,v|
- v = v.upcase == 'NULL' ? nil : v.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1')
- k = k.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1')
+ v = v.upcase == 'NULL' ? nil : v.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
+ k = k.gsub(/\A"(.*)"\Z/m,'\1').gsub(/\\(.)/, '\1')
[k,v]
}]
else
@@ -189,6 +189,10 @@ def test_quoting_special_characters
assert_cycle('ca' => '', 'ac' => 'àc')
end
+ def test_multiline
+ assert_cycle("a\nb" => "c\nd")
+ end
+
private
def assert_cycle hash
# test creation

0 comments on commit e96fa89

Please sign in to comment.