string-utility 2.3.0 → 2.4.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/lib/utils.rb +10 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83db5676a6b6fa1bdc93eea41ac95a8c1995043b
4
- data.tar.gz: 04b1559a4fbbeb3cecde296e48595c7c3f6c1fa9
3
+ metadata.gz: 31a8358a03fd06e93b86cda830d7fd251ab3fcad
4
+ data.tar.gz: 6238c0ee73b6139493c9c545cc8a731519fd91dc
5
5
  SHA512:
6
- metadata.gz: 3dd6bf662182e34ca50641fc8a9156852ee5b21cee67260e25f80d50715425f1d14aa4383cbc2eb40396ad68c9d6d71d44c330bd30c4f6a5941e925827b3545e
7
- data.tar.gz: bfb2688ee807a3cfb7c34fa6acccaefcb8a2ad368dede95e84a6641fd1c18efd0b8650704ea1234a626ca137b69e9d10ad1feaae37ae128b9e233cad1af4c781
6
+ metadata.gz: a2cc24a42e2c84446dcfbfd7c6a9cd662cf9881f05394783c3d582768ac89ba352a89e099f213a0c209e2ca0d0669e22e1325222699b0ce0f0b4c9f9479c8413
7
+ data.tar.gz: 94e9cb446ffe73004f88e775effa4baa116cc15b4209f236a1bba9b528c1235d03df628b06ef2d1c60cc7143aff7501f5103fb011ae7327356cdadb695a3216f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
  ## Version 2
3
+ ### Version 2.4.0
4
+ * New random_line method for getting a random line in a file.
5
+
3
6
  ### Version 2.3.0
4
7
  * New spacify method, which is essentially the opposite of underscorify.
5
8
 
data/lib/utils.rb CHANGED
@@ -43,4 +43,14 @@ module StringUtility
43
43
  string
44
44
  end
45
45
  end
46
+
47
+ extend self
48
+
49
+ # Gets a random line in a file.
50
+ # @param path [String] The path to the file.
51
+ # @return [String] A random line in the file.
52
+ def self.random_line(path)
53
+ read = File.readlines(path)
54
+ read[rand(read.size)]
55
+ end
46
56
  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.3.0
4
+ version: 2.4.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-14 00:00:00.000000000 Z
11
+ date: 2015-10-15 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