string-utility 2.7.1 → 2.7.2

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: 43632282870b5f9d39eb984e7f8e9078d09e85d5
4
- data.tar.gz: b471b51a2f3ff879251cda80ddea7ce86e8e67c7
3
+ metadata.gz: 6e462553b6a77784d686ffad8ffbfc7ccd9b1959
4
+ data.tar.gz: 28208aab108398aefb3bbd5ac5c10fd05e144776
5
5
  SHA512:
6
- metadata.gz: c72f0bf37646c2c3363eed1e2bff1dbd9f195fd2649581800677893e4f046249f38747a8b13034f5cb05994246a02dd4981afef2ba53c624cd16880966538b7f
7
- data.tar.gz: 63d7eab095e0f1638dc47d94bea54c994568e0dbaf493f885486cc79ef74392779faaf8f472a3e819e61a5c7850495751b1f1c199d51c5ee998e3017bd0035ff
6
+ metadata.gz: 85f2d11d7b1428287c9a0ed6f15b58313d876bd152f29b261b02084325848f95aa6e682792eecf2d4653ca4a89e5e369d9afd4d32942fe2eb0ddab390253a6d3
7
+ data.tar.gz: 119bd520fdac35064f8a5756016b42815680937bbca8c3f3a20dba34e0136c1a6a30bf8d58d823b1d6f425ca9d43c611b5dddc2719d160020fd3c37246d3cae4
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
  ## Version 2
3
+ ### Version 2.7.2
4
+ * No longer include tests in gem package.
5
+ * License as MIT
6
+
3
7
  ### Version 2.7.1
4
8
  * Improve random_line performance by approximately 1 second real time.
5
9
  * Improve random_color performance by about 400-500%.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string-utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Foster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " Some simple but handy methods to interact with string objects.\n"
14
14
  email: elifosterwy@gmail.com
@@ -19,11 +19,9 @@ files:
19
19
  - CHANGELOG.md
20
20
  - lib/string-utility.rb
21
21
  - lib/utils.rb
22
- - spec/benchmark.rb
23
- - spec/testcases.rb
24
22
  homepage: https://github.com/elifoster/string-utility-ruby
25
23
  licenses:
26
- - CC-BY-NC-ND-4.0
24
+ - MIT
27
25
  metadata:
28
26
  issue_tracker: https://github.com/elifoster/string-utility-ruby/issues
29
27
  post_install_message:
@@ -1,85 +0,0 @@
1
- require 'benchmark'
2
- if ARGV.include?('--gem')
3
- require 'string-utility'
4
- else
5
- require_relative '../lib/utils'
6
- end
7
-
8
- TIMES = 100_000
9
- using StringUtility
10
- Benchmark.bm do |b|
11
- b.report('separate') do
12
- TIMES.times do
13
- '1000'.separate
14
- end
15
- end
16
-
17
- b.report('to_i_separated') do
18
- TIMES.times do
19
- '1,000'.to_i_separated
20
- end
21
- end
22
-
23
- b.report('underscorify') do
24
- TIMES.times do
25
- ' '.underscorify
26
- end
27
- end
28
-
29
- b.report('spacify') do
30
- TIMES.times do
31
- '_____'.spacify
32
- end
33
- end
34
-
35
- b.report('random_line') do
36
- TIMES.times do
37
- StringUtility.random_line("#{Dir.pwd}/README.md")
38
- end
39
- end
40
-
41
- b.report('color 3') do
42
- TIMES.times do
43
- StringUtility.random_color_three
44
- end
45
- end
46
-
47
- b.report('color 6') do
48
- TIMES.times do
49
- StringUtility.random_color_six
50
- end
51
- end
52
- end
53
-
54
- Benchmark.bm do |b|
55
- b.report('gsub! success') do
56
- TIMES.times do
57
- 'ABC'.gsub!('ABC', '123')
58
- end
59
- end
60
-
61
- b.report('safely_gsub! success') do
62
- TIMES.times do
63
- 'ABC'.safely_gsub!('ABC', '123')
64
- end
65
- end
66
-
67
- b.report('gsub! fail') do
68
- TIMES.times do
69
- 'ABC'.gsub!('DEF', '456')
70
- end
71
- end
72
-
73
- b.report('gsub! fail safe') do
74
- TIMES.times do
75
- str = 'ABC'
76
- str.gsub!('DEF', '456') || str
77
- end
78
- end
79
-
80
- b.report('safely_gsub! fail') do
81
- TIMES.times do
82
- 'ABC'.safely_gsub!('DEF', '456')
83
- end
84
- end
85
- end
@@ -1,47 +0,0 @@
1
- require 'test/unit'
2
- require_relative '../lib/utils'
3
-
4
- class TestStringUtility < Test::Unit::TestCase
5
- using StringUtility
6
- def test_separate
7
- assert_equal('1,000', '1000'.separate)
8
- assert_equal('10,00', '1000'.separate(2))
9
- assert_equal('1:000', '1000'.separate(3, ':'))
10
- assert_equal('10:00', '1000'.separate(2, ':'))
11
- assert_equal('100', '100'.separate)
12
- end
13
-
14
- def test_to_i_sparated
15
- assert_equal(1000, '1,000'.to_i_separated)
16
- assert_equal(1000, '1000'.to_i_separated)
17
- end
18
-
19
- def test_underscorify
20
- assert_equal('_', ' '.underscorify)
21
- assert_equal('Test', 'Test'.underscorify)
22
- end
23
-
24
- def test_spacify
25
- assert_equal(' ', '_'.spacify)
26
- assert_equal('Test', 'Test'.spacify)
27
- end
28
-
29
- def test_random_line
30
- assert_instance_of(String, StringUtility.random_line("#{Dir.pwd}/" \
31
- 'spec/testcases.rb'))
32
- end
33
-
34
- def test_random_color_three
35
- assert_instance_of(String, StringUtility.random_color_three)
36
- end
37
-
38
- def test_random_color_six
39
- assert_instance_of(String, StringUtility.random_color_six)
40
- end
41
-
42
- def test_safely_gsub
43
- assert_equal('b', 'b'.safely_gsub!('a', '1'))
44
- assert_not_nil('b'.safely_gsub!('a', '1'))
45
- assert_equal('bb', 'ab'.safely_gsub!('a', 'b'))
46
- end
47
- end