strip_comments 0.1.4 → 0.2.0

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
  SHA256:
3
- metadata.gz: 1ec13ae19f0156ef9323fae1380e5679e70fa2efa4a240f008fa4d826c34ffd5
4
- data.tar.gz: 8e6aa63f575e1dcd62e94015097b4a2120be898cfc616b389aacf616e230b370
3
+ metadata.gz: 24843c0b9b7dd3bdf82bd0e951cb3ce0c981f294d7a6324577e84bccffb7362e
4
+ data.tar.gz: 2d6e82506144c68b5ad333c21cd41dad14df6f6eb988e77f8e280df538dba88b
5
5
  SHA512:
6
- metadata.gz: 05e804a98e1988694ca113afea91db5537017eb5fbea14ab1a09837332472a8beb793aec6ef5f0b90ebab2d153301dd8a63e1bcd095bad64bb1874442170b6be
7
- data.tar.gz: 530a3af21c142bae70dcc776662b4cc4890d91e47a1956c1d4a30c8b9e7863b59b8202b843431d6a90a911cf1cc64ec4203f905279f7049335f73d97f80143e5
6
+ metadata.gz: 0d675f04fef958452d383dbde97048cd46e074b7678508d24bf060e2f88a6d73d3fa3b39a33959b0bdd05f0cd536d46d8ade823162fac3750600e88e652aa181
7
+ data.tar.gz: '099ca0984bebe01c6eef730d5877272642acbcdb0c6a4e5337b7c18c1d092dfae8fc2f488fa5e829270fe9f492364d62e82d3db672bcb2bff330b8a8189ebf14'
data/README.md CHANGED
@@ -29,7 +29,15 @@ stripped = StripComments::strip_yaml(input)
29
29
  You can use this to, for example, rewrite all source files in a folder:
30
30
 
31
31
  ```rb
32
- TODO
32
+ require "strip_comments"
33
+
34
+ Dir.glob(File.join(File.dirname(__FILE__), "..", "**", "*.{css,html,yml,properties,glsl}")).each do |filename|
35
+ extension = filename.split(".").last
36
+ input = File.open(filename).read
37
+ output = StripComments::strip(extension, input)
38
+
39
+ File.write(filename, output)
40
+ end
33
41
  ```
34
42
 
35
43
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StripComments
4
- VERSION = "0.1.4"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -40,7 +40,7 @@ module StripComments
40
40
  str.gsub!(/#[^\n]+/, '')
41
41
 
42
42
  stripped_strings_to_not_be_uncommented.reverse_each do |k,v|
43
- str[k] = v
43
+ str.gsub!(k, v)
44
44
  end
45
45
 
46
46
  str
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.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jevon Wright