semantic_linefeeds 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/lib/semantic_linefeeds/cli.rb +13 -10
- data/lib/semantic_linefeeds/converter.rb +2 -2
- data/lib/semantic_linefeeds/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a2e3ae8e3a4cde6618c4b0b2c5e3bae2b6a53d3
|
4
|
+
data.tar.gz: 11cfc36682b0aff77e3e7985f5ed732d018b33e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f17405fd1a752b74f5b486c9dbe6c05ee0b36551960228906fbd7cd9a7adeac103cf0446821ac96da9b10194a605d780da54720b770f9b7c71d9d83a655c4aec
|
7
|
+
data.tar.gz: 3a3ace871343efbdb7159de23616c40e27ae945279c1f87f25cde59357a5252ec7d967e9e3353273fc4ed2d6ff744587c9a60db282238e947dfb600745a61796
|
data/.rubocop.yml
CHANGED
@@ -114,7 +114,7 @@ Style/StringLiteralsInInterpolation:
|
|
114
114
|
SupportedStyles:
|
115
115
|
- single_quotes
|
116
116
|
- double_quotes
|
117
|
-
Style/
|
117
|
+
Style/TrailingCommaInLiteral:
|
118
118
|
Description: Checks for trailing comma in parameter lists and literals.
|
119
119
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
|
120
120
|
Enabled: false
|
@@ -1,24 +1,27 @@
|
|
1
1
|
module SemanticLinefeeds
|
2
2
|
class CLI
|
3
3
|
def initialize(args)
|
4
|
-
|
5
|
-
input = File.read(args[0])
|
6
|
-
else
|
7
|
-
input = string_from_args(args)
|
8
|
-
end
|
9
|
-
|
4
|
+
@args = args
|
10
5
|
puts Converter.run(input)
|
11
6
|
end
|
12
7
|
|
13
8
|
private
|
14
9
|
|
10
|
+
def input
|
11
|
+
if File.exist?(@args[0])
|
12
|
+
File.read(@args[0])
|
13
|
+
else
|
14
|
+
string_from_args
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
15
18
|
# If the user passes the string in surrounded by quotes, return that string.
|
16
19
|
# Else, if they don't, we'll join all the args into a string.
|
17
|
-
def string_from_args
|
18
|
-
if args.is_a?(Array)
|
19
|
-
args.join(" ")
|
20
|
+
def string_from_args
|
21
|
+
if @args.is_a?(Array)
|
22
|
+
@args.join(" ")
|
20
23
|
else
|
21
|
-
args
|
24
|
+
@args
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|