strip_comments 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: a6f9367d9a2c983ee03ec2e9234c3dc5eecfefb0a23902d6c047c46e585e7c70
4
- data.tar.gz: de618829cf9755f3126ecdd55701379f8bb8240daf798a398b21cb887cec6cec
3
+ metadata.gz: 1ec13ae19f0156ef9323fae1380e5679e70fa2efa4a240f008fa4d826c34ffd5
4
+ data.tar.gz: 8e6aa63f575e1dcd62e94015097b4a2120be898cfc616b389aacf616e230b370
5
5
  SHA512:
6
- metadata.gz: 13ca27a702dff9178b92ca85dc317f79c023778e7f8917013919acea67332f721d9b9fb7e6cfcda0f87184f2068d5b9b9eb0222c521359886b7d32dafde4cec4
7
- data.tar.gz: c141f78bbf7553ea09a834570362f7dd2bbb800bcb6b3748eb935d9e479eb5b7b6a985de1b99ecdda7c3758b91a08441d9729eae8c0dccfdbd28165b95643d98
6
+ metadata.gz: 05e804a98e1988694ca113afea91db5537017eb5fbea14ab1a09837332472a8beb793aec6ef5f0b90ebab2d153301dd8a63e1bcd095bad64bb1874442170b6be
7
+ data.tar.gz: 530a3af21c142bae70dcc776662b4cc4890d91e47a1956c1d4a30c8b9e7863b59b8202b843431d6a90a911cf1cc64ec4203f905279f7049335f73d97f80143e5
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StripComments
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -25,23 +25,21 @@ module StripComments
25
25
  def self.strip_yaml(str)
26
26
  stripped_strings_to_not_be_uncommented = {}
27
27
 
28
- str.gsub!(/'([^']+)'/) do |m|
28
+ str.gsub!(/"([^\n"]+)"/) do |m|
29
29
  strip_key = "__STRIPPED_KEY_#{stripped_strings_to_not_be_uncommented.size}__"
30
30
  stripped_strings_to_not_be_uncommented[strip_key] = m
31
- puts "replacing '#{m}' with '#{strip_key}'"
32
31
  strip_key
33
32
  end
34
33
 
35
- str.gsub!(/"([^"]+)"/) do |m|
34
+ str.gsub!(/'([^\n']+)'/) do |m|
36
35
  strip_key = "__STRIPPED_KEY_#{stripped_strings_to_not_be_uncommented.size}__"
37
36
  stripped_strings_to_not_be_uncommented[strip_key] = m
38
- puts "replacing '#{m}' with '#{strip_key}'"
39
37
  strip_key
40
38
  end
41
39
 
42
40
  str.gsub!(/#[^\n]+/, '')
43
41
 
44
- stripped_strings_to_not_be_uncommented.each do |k,v|
42
+ stripped_strings_to_not_be_uncommented.reverse_each do |k,v|
45
43
  str[k] = v
46
44
  end
47
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strip_comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jevon Wright