activerecord-postgres-array 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "activerecord-postgres-array"
3
- s.version = "0.0.7"
3
+ s.version = "0.0.8"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Tim Connor"]
@@ -20,7 +20,7 @@ class String
20
20
  if empty?
21
21
  []
22
22
  else
23
- elements = match(/\{(.*)\}/).captures.first.gsub(/\\"/, '$ESCAPED_DOUBLE_QUOTE$').split(/(?:,)(?=(?:[^"]|"[^"]*")*$)/)
23
+ elements = match(/\{(.*)\}/m).captures.first.gsub(/\\"/, '$ESCAPED_DOUBLE_QUOTE$').split(/(?:,)(?=(?:[^"]|"[^"]*")*$)/m)
24
24
  elements = elements.map do |e|
25
25
  res = e.gsub('$ESCAPED_DOUBLE_QUOTE$', '"').gsub("\\\\", "\\").gsub(/^"/, '').gsub(/"$/, '').gsub("''", "'").strip
26
26
  res == 'NULL' ? nil : res
@@ -101,5 +101,9 @@ describe "String" do
101
101
  it 'correctly handles backslashes' do
102
102
  '\'{"\\\\","\\""}\''.from_postgres_array.should == ["\\","\""]
103
103
  end
104
+
105
+ it 'correctly handles multi line content' do
106
+ "{A\nB\nC,X\r\nY\r\nZ}".from_postgres_array.should == ["A\nB\nC", "X\r\nY\r\nZ"]
107
+ end
104
108
  end
105
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-array
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Connor
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-08 00:00:00 -08:00
19
- default_executable:
18
+ date: 2012-02-08 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: activerecord
@@ -115,7 +114,6 @@ files:
115
114
  - spec/internal/db/schema.rb
116
115
  - spec/spec_helper.rb
117
116
  - spec/string_ext_spec.rb
118
- has_rdoc: true
119
117
  homepage: https://github.com/tlconnor/activerecord-postgres-array
120
118
  licenses: []
121
119
 
@@ -145,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
143
  requirements: []
146
144
 
147
145
  rubyforge_project:
148
- rubygems_version: 1.6.2
146
+ rubygems_version: 1.8.24
149
147
  signing_key:
150
148
  specification_version: 3
151
149
  summary: Adds support for postgres arrays to ActiveRecord