replace_quotes 0.0.0 → 0.0.1

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: 42d7a6972e132f6145e3239f7492ec349075e883
4
- data.tar.gz: cfbbef6c1208708ddf66370463d3b3b45958561a
3
+ metadata.gz: b427c7e3679778147163ac293702a24e2e628699
4
+ data.tar.gz: c5bfc591618cbdd9ec60a1129ae7ad1805ca26fb
5
5
  SHA512:
6
- metadata.gz: 2f605bcb24b9157cd09b1cd90b9f0b3833092e71c7cc7b4de89123bd3383421ded5227d2d330ecde3090c8f3d63f89d18b10f260b5e3903107f8f4e1caf6bf09
7
- data.tar.gz: b22b8e43c1681852523b1678cc95382dd047ed0735b15776a5032ad8313e2447c6003fec339f5dfd3200eb735304995963e1d51eed4f4663e8a6c6182212a511
6
+ metadata.gz: 0607f27da3ced8b6cbb6725e25b33d579294f14e66254519177d01c30e8a511b813c61794d0c6c16aa54e5e77cb4ceab8a8a78c215cc8efddbf2a24d5b7b0b16
7
+ data.tar.gz: 377cb91630dd6364eafccb3409d0d380964c0fb88e7947fdb6762473d763014ba84e131f75dfef9849655b82610398a98e4cb681933ceaf262010351f82a13eb
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/replace_quotes.svg)](https://badge.fury.io/rb/replace_quotes)
1
2
  [![Dependency Status](https://gemnasium.com/jhsu802701/replace_quotes.svg)](https://gemnasium.com/jhsu802701/replace_quotes)
2
3
  [![Build Status](https://travis-ci.org/jhsu802701/replace_quotes.svg?branch=master)](https://travis-ci.org/jhsu802701/replace_quotes)
3
4
  [![Code Climate](https://codeclimate.com/github/jhsu802701/replace_quotes/badges/gpa.svg)](https://codeclimate.com/github/jhsu802701/replace_quotes)
@@ -6,7 +7,7 @@
6
7
 
7
8
  # ReplaceQuotes
8
9
 
9
- This gem is used for improving RuboCop compliance by replacing unnecessary double quotes with single quotes in a file. To avoid causing errors, ReplaceQuotes leaves double quotes alone when they are used in a line containing single quotes.
10
+ This gem is used for improving RuboCop compliance by replacing unnecessary double quotes with single quotes in a file. To avoid causing errors, ReplaceQuotes leaves double quotes alone when they are used in a line containing single quotes or "#{".
10
11
  <br><br>
11
12
  Before:
12
13
  ```
@@ -15,6 +16,11 @@ Before:
15
16
 
16
17
  "I hope we're using Ruby on High Speed Rails"
17
18
  "There's Ruby on High Speed Rails, and there's Not Exactly."
19
+
20
+ option1 = "High Speed Ruby on Rails"
21
+ option2 = "Not Exactly"
22
+ "#{option1} is much better and faster than #{option2}."
23
+
18
24
  ```
19
25
  After:
20
26
  ```
@@ -23,6 +29,10 @@ After:
23
29
 
24
30
  "I hope we're using Ruby on High Speed Rails"
25
31
  "There's Ruby on High Speed Rails, and there's Not Exactly."
32
+
33
+ option1 = 'High Speed Ruby on Rails'
34
+ option2 = 'Not Exactly'
35
+ "#{option1} is much better and faster than #{option2}."
26
36
  ```
27
37
 
28
38
  ## Installation
@@ -9,7 +9,9 @@ module ReplaceQuotes
9
9
  path_new = "#{path_old}.new"
10
10
  file_w = open(path_new, 'w')
11
11
  File.readlines(path_old).each do |line|
12
- if (line.include? '"') == true && (line.include? "'") == false
12
+ single_quote = (line.include? "'")
13
+ pound_cb = (line.include? '#{')
14
+ if (single_quote == false) && (pound_cb == false)
13
15
  line_alt = line.tr('"', "'")
14
16
  file_w.write(line_alt)
15
17
  else
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module ReplaceQuotes
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  end
data/test_files/test3.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  "There is Ruby on High Speed Rails, and there is Not Exactly."
2
2
  "Make sure you choose the correct one."
3
3
 
4
- "I hope we're using Ruby on High Speed Rails"
4
+ "I hope we're using Ruby on High Speed Rails."
5
5
  "There's Ruby on High Speed Rails, and there's Not Exactly."
@@ -1,5 +1,5 @@
1
1
  'There is Ruby on High Speed Rails, and there is Not Exactly.'
2
2
  'Make sure you choose the correct one.'
3
3
 
4
- "I hope we're using Ruby on High Speed Rails"
4
+ "I hope we're using Ruby on High Speed Rails."
5
5
  "There's Ruby on High Speed Rails, and there's Not Exactly."
@@ -0,0 +1,9 @@
1
+ "There is Ruby on High Speed Rails, and there is Not Exactly."
2
+ "Make sure you choose the correct one."
3
+
4
+ "I hope we're using Ruby on High Speed Rails"
5
+ "There's Ruby on High Speed Rails, and there's Not Exactly."
6
+
7
+ option1 = "High Speed Ruby on Rails"
8
+ option2 = "Not Exactly"
9
+ "#{option1} is much better and faster than #{option2}."
@@ -0,0 +1,9 @@
1
+ 'There is Ruby on High Speed Rails, and there is Not Exactly.'
2
+ 'Make sure you choose the correct one.'
3
+
4
+ "I hope we're using Ruby on High Speed Rails"
5
+ "There's Ruby on High Speed Rails, and there's Not Exactly."
6
+
7
+ option1 = 'High Speed Ruby on Rails'
8
+ option2 = 'Not Exactly'
9
+ "#{option1} is much better and faster than #{option2}."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: replace_quotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Hsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,6 +170,8 @@ files:
170
170
  - test_files/test3a.txt
171
171
  - test_files/test4.txt
172
172
  - test_files/test4a.txt
173
+ - test_files/test5.txt
174
+ - test_files/test5a.txt
173
175
  homepage: https://github.com/jhsu802701/replace_quotes
174
176
  licenses:
175
177
  - MIT