countr 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/countr +12 -2
  3. data/lib/countr/version.rb +1 -1
  4. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1ef959647b95149f6234b8f35885636436a8c89
4
- data.tar.gz: 4d13a631e71e025be0ccb15310e68182cd6ca893
3
+ metadata.gz: d3d3f2727dbafb11308176b4184a562dc2d62f9a
4
+ data.tar.gz: 4e0d0dd2820b1d29c4aacfcd625752f77af2c783
5
5
  SHA512:
6
- metadata.gz: b4fde3c410a5c02ea57a1c609723404136be6fbe00c05de2318a6b3cbe5f584a5c47c68c9a089b2aeb6bbf8cd9e6428b1a04c87c0925a14c5f1bf974f7479706
7
- data.tar.gz: 024b31e1b172c68fd8ba6d62800740473a457b5941f528ade0ad15e396ffe4c83d8fbf766a67920a89c97f88e78ab132261d8ad6d65af7e07c79e7e23d369913
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
- print count
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)
@@ -1,3 +1,3 @@
1
1
  module Countr
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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: 2015-12-01 00:00:00.000000000 Z
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.5.0
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