jsonapi_compliable 0.11.25 → 0.11.26

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acf72913f3b6e1195890cc3acab2cb8495f93833
4
- data.tar.gz: 5cd4565c47b237c7a8a93184186153e561ab189d
3
+ metadata.gz: 63d6810b917de89c84b683301cd42dbb0d88a6ae
4
+ data.tar.gz: 13312ec071a1764665f701020898e856e45f0825
5
5
  SHA512:
6
- metadata.gz: 24e4611a4f68c86fb9c53a8f3696f858a2be6cf2841b75c703ae31eeea472df24ceaf923879fa1030ab1c8d365443556147ea7c947790ad5cd9b32cb7b4faa68
7
- data.tar.gz: edd3c317eedc9bb83ec74f66a9d412ddad38b0fc599ca25093559a988b44a9f1968b28c02d93ab39c7ab866a4b97ea8146ba286eec07a4e2201ca99694de5fc3
6
+ metadata.gz: 52f9e04896faeeaab2a0e6e4661a2e69568c25c2c484d824b8df6a217c1c467676c3c99584e92196d3996a32df816b43b3eafdb8d8cd4004236f67b0d6191583
7
+ data.tar.gz: 2650a80b254d475ba962af09c9cfa7105f156340df388313b6fa6c55df1859f9bc47d5e29eded38dfdd12bafd1bae2c5b88d77d94617cd526245607e910e2adb
@@ -61,19 +61,28 @@ module JsonapiCompliable
61
61
  # foo,bar,baz becomes ["foo", "bar", "baz"]
62
62
  # {{foo}} becomes ["foo"]
63
63
  # {{foo,bar}},baz becomes ["foo,bar", "baz"]
64
+ #
65
+ # JSON of
66
+ # {{{ "id": 1 }}} becomes { 'id' => 1 }
64
67
  def parse_string_arrays(value)
65
- if value.is_a?(String)
66
- # Find the quoted strings
67
- quotes = value.scan(/{{.*?}}/)
68
- # remove them from the rest
69
- quotes.each { |q| value.gsub!(q, '') }
70
- # remove the quote characters from the quoted strings
71
- quotes.each { |q| q.gsub!('{{', '').gsub!('}}', '') }
72
- # merge everything back together into an array
73
- value = Array(value.split(',')) + quotes
74
- # remove any blanks that are left
75
- value.reject! { |v| v.length.zero? }
76
- value = value[0] if value.length == 1
68
+ if value.is_a?(String)# && value[0..2] != '{{{'
69
+ # Escaped JSON
70
+ if value[0..2] == '{{{'
71
+ value = value.sub('{{', '').sub('}}', '')
72
+ value = JSON.parse(value)
73
+ else
74
+ # Find the quoted strings
75
+ quotes = value.scan(/{{.*?}}/)
76
+ # remove them from the rest
77
+ quotes.each { |q| value.gsub!(q, '') }
78
+ # remove the quote characters from the quoted strings
79
+ quotes.each { |q| q.gsub!('{{', '').gsub!('}}', '') }
80
+ # merge everything back together into an array
81
+ value = Array(value.split(',')) + quotes
82
+ # remove any blanks that are left
83
+ value.reject! { |v| v.length.zero? }
84
+ value = value[0] if value.length == 1
85
+ end
77
86
  end
78
87
  value
79
88
  end
@@ -1,3 +1,3 @@
1
1
  module JsonapiCompliable
2
- VERSION = "0.11.25"
2
+ VERSION = "0.11.26"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_compliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.25
4
+ version: 0.11.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-08-13 00:00:00.000000000 Z
12
+ date: 2018-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-serializable