string-utility 2.4.1 → 2.5.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/CHANGELOG.md +4 -0
  3. data/lib/utils.rb +18 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a636cadcb2265ae0500538f0cf538a0492788268
4
- data.tar.gz: 0ee615818ba03e59b8896157106a876e109c907a
3
+ metadata.gz: bbed80c84e8c9dc5be73278ee680d7ca18725cb6
4
+ data.tar.gz: 6d56ccbb30cd8d20f5c8f46e91d6344740b8aba3
5
5
  SHA512:
6
- metadata.gz: 34d9fbefafef5b6453d7a51f5f211ec67015676409b4ce55b9b737b17f26b3e6e46a27e32ce24b034ca5f850610f3bfe44d3754ba287ed4304daa6e54d2decce
7
- data.tar.gz: e1ad8198110d6efbae52a5051e2984a0e90dc6a5958f2a53497ddacc8e3318b41e68f89616b3aea16978156fc6004a126373ba4b87a10d7271b4ea2a6465f1bf
6
+ metadata.gz: 8d957ddac0fdd2075c069439174712302e6494a643f757154c1ba612564a6126d10e4d9642458a372c7f222b3a2ffe78b0b58bcb68996a2d64fea2b08757d82a
7
+ data.tar.gz: ceadb86fd6073c37802427ac3c8b80bc080f168a17ef360b81646c3dbee021803d0a3f125d9db1c7efc844da1025eb867eaee07eeca8e6f137493eaa059f7892
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
  ## Version 2
3
+ ### Version 2.5.0
4
+ * Improved spacify performance slightly.
5
+ * New methods for getting web colors.
6
+
3
7
  ### Version 2.4.1
4
8
  * random_line properly returns the chomped version.
5
9
 
data/lib/utils.rb CHANGED
@@ -39,7 +39,7 @@ module StringUtility
39
39
  # @return [String] The string with replaced underscores.
40
40
  def spacify
41
41
  string = self
42
- string = string.gsub('_', ' ')
42
+ string = string.tr('_', ' ')
43
43
  string
44
44
  end
45
45
  end
@@ -53,4 +53,21 @@ module StringUtility
53
53
  read = File.readlines(path)
54
54
  read[rand(read.size)].chomp
55
55
  end
56
+
57
+ def self.random_color_three
58
+ string = random_color(0..2)
59
+ "##{string}"
60
+ end
61
+
62
+ def self.random_color_six
63
+ string = random_color(0..5)
64
+ "##{string}"
65
+ end
66
+
67
+ private
68
+
69
+ def random_color(limit)
70
+ values = (('A'..'F').to_a + (0..9).to_a)
71
+ limit.map { values.sample }.join
72
+ end
56
73
  end
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.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Foster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-15 00:00:00.000000000 Z
11
+ date: 2015-10-27 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