form_stalker 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71c9e6082066146895626125b4282d9bb90aaa21
4
- data.tar.gz: bfe54fbab6ef59301179bfd73c3729173302b468
3
+ metadata.gz: f9b53d8d01b3c038a6691ea9d99be24f0053b575
4
+ data.tar.gz: 5bce75bc933758fd2f8b807e019f5f66432ed246
5
5
  SHA512:
6
- metadata.gz: 8fef77d58422c9853be86d8498a535e649ef8875a3ee957e20bbe62410251a3e24bb4d9f3c92731c0133123f23c97f2ee69ad1cddb371c33d374110dbfd3464c
7
- data.tar.gz: 0c882abd9a2e6f5ee9527c84bdb361f9fdbf5229928da050e5e7bbf2ded9afe7676f8f5761777bd11c3bac19fbb11a7ae409348cc4b4172284fedd819737b48f
6
+ metadata.gz: 681f0a9d056a3b80bfecce553e2b356005a7a6f945c3fd8291b381e0f9c989f84e2e22653546d18b414d669aaccaa02c4b09ef58ee3ac06c274b6eb8d9e6ead4
7
+ data.tar.gz: 43813697816d2fd2ec4ac68d3473d3855613cd6af788070ad6b9e3b27d6f20910497d5c6a9e480efe8f786daa34d8f3326e7e7b421c4f497fd408d26b7c51c32
@@ -24,13 +24,19 @@ module FormStalker
24
24
  protected ####################### PROTECTED ##############################
25
25
 
26
26
  def js_to_json(js_object)
27
- js_object.split(',').map(&:strip).map do |js_string|
27
+ split(js_object).map(&:strip).map do |js_string|
28
28
  escape_js_to_json(js_string)
29
29
  end.join(', ')
30
30
  end
31
31
 
32
32
  private ######################### PRIVATE ################################
33
33
 
34
+ def split(js_object)
35
+ js_object
36
+ .split(/(,)(?=(?:[^']|'[^']*')*$)/)
37
+ .reject { |string| string == ',' }
38
+ end
39
+
34
40
  def escape_js_to_json(js_string)
35
41
  string = js_string.tr('"', '\"')
36
42
  .tr("'", '"')
@@ -1,3 +1,3 @@
1
1
  module FormStalker
2
- VERSION = '1.0.3'.freeze
2
+ VERSION = '1.0.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form_stalker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - StreetBees Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-17 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr