countr 1.0.0 → 1.1.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 +4 -4
- data/bin/countr +12 -2
- data/lib/countr/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d3f2727dbafb11308176b4184a562dc2d62f9a
|
4
|
+
data.tar.gz: 4e0d0dd2820b1d29c4aacfcd625752f77af2c783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c3bd7dcf274923be675ffa310e236fdef23895126d5c7fe5953f6b3130ae9a9a5199587f1d3437391b619ba24e6ad4de69df6221f908fa4297304da57c37fc2
|
7
|
+
data.tar.gz: 2d74f3a24c9899c7865e79ad89a72afd6d6c5cea7c5bf7cc19c1fe81f65f417b51c1d2c6925a89c01bdfe476a68a1ec524786c9452122bef1f6ce51a813b47f5
|
data/bin/countr
CHANGED
@@ -6,7 +6,9 @@ require_relative '../lib/countr/version'
|
|
6
6
|
BINARY_NAME = $PROGRAM_NAME.split('/').last
|
7
7
|
|
8
8
|
def parse_options
|
9
|
-
options = {
|
9
|
+
options = {
|
10
|
+
:oneline => false
|
11
|
+
}
|
10
12
|
|
11
13
|
optparse = OptionParser.new do |opts|
|
12
14
|
opts.banner = "Displays the number of characters in a string\n"
|
@@ -18,6 +20,10 @@ def parse_options
|
|
18
20
|
exit
|
19
21
|
end
|
20
22
|
|
23
|
+
opts.on('-n', '--no-line-break', 'No newline when returning count') do
|
24
|
+
options[:oneline] = true
|
25
|
+
end
|
26
|
+
|
21
27
|
opts.on('-h', '-?', '--help', 'Display this screen and exit') do
|
22
28
|
puts opts
|
23
29
|
exit
|
@@ -48,7 +54,11 @@ begin
|
|
48
54
|
count += words[i].length
|
49
55
|
end
|
50
56
|
|
51
|
-
|
57
|
+
if options[:oneline]
|
58
|
+
print count
|
59
|
+
else
|
60
|
+
puts count
|
61
|
+
end
|
52
62
|
rescue => error
|
53
63
|
print_error(error)
|
54
64
|
exit(false)
|
data/lib/countr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,8 +93,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.11
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Displays the number of character in a string
|
100
|
-
test_files:
|
100
|
+
test_files:
|
101
|
+
- spec/count_spec.rb
|
102
|
+
- spec/spec_helper.rb
|