replace_quotes 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/replace_quotes.rb +3 -1
- data/lib/replace_quotes/version.rb +1 -1
- data/test_files/test3.txt +1 -1
- data/test_files/test3a.txt +1 -1
- data/test_files/test5.txt +9 -0
- data/test_files/test5a.txt +9 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b427c7e3679778147163ac293702a24e2e628699
|
4
|
+
data.tar.gz: c5bfc591618cbdd9ec60a1129ae7ad1805ca26fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/replace_quotes.rb
CHANGED
@@ -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
|
-
|
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
|
data/test_files/test3.txt
CHANGED
data/test_files/test3a.txt
CHANGED
@@ -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.
|
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-
|
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
|