string-utility 2.0.0 → 2.0.1
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/CHANGELOG.md +4 -0
- data/lib/utils.rb +8 -7
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c07c4048933918e138ae01dd24da04e05da748f6
|
4
|
+
data.tar.gz: 878598e93962656a0121a5ef0455cda8bc97e64b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ed9853a139ce45d12174ed1f175cd35ce2dcea98a74b23804f0fb10a0c6776ff58e3731b067924c7593453cfc470addc8e6508d9857c8fb655746bb12899b3
|
7
|
+
data.tar.gz: c59ac5af0d4d974ac7a92b21ed7632063faa2fedf5e99a700d6bea6b34d5522de462c3667c63c3cd4eee97025db709c9957516f82f6262ba01321464cb06bf8b
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
## Version 2
|
3
|
+
### Version 2.0.1
|
4
|
+
* Fixed style issues thanks to Rubocop.
|
5
|
+
|
3
6
|
### Version 2.0.0
|
4
7
|
* There is no longer an initialize method.
|
5
8
|
* separate is now a monkeypatch using the refine keyword.
|
6
9
|
|
10
|
+
## Version 1
|
7
11
|
### Version 1.0.1
|
8
12
|
* No longer need to create an instance of StringUtility. Not really sure why I made that the case in the first place.
|
9
13
|
### Version 1.0.0
|
data/lib/utils.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
module StringUtility
|
2
|
-
|
3
2
|
refine String do
|
4
|
-
# Separates the string by another string. Useful for converting integers
|
3
|
+
# Separates the string by another string. Useful for converting integers
|
4
|
+
# into human-readable numbers.
|
5
5
|
# @param count [Int] The number of integers to separate by. Defaults to 3.
|
6
|
-
# @param separator [String] The string to use as a separator. Can only be
|
6
|
+
# @param separator [String] The string to use as a separator. Can only be
|
7
|
+
# 1 character long. Will use the first character if it is greater than
|
8
|
+
# 1 character long. Defaults to a comma.
|
7
9
|
# @return [String] Formatted version of the provided string.
|
8
10
|
def separate(count = 3, separator = ',')
|
9
|
-
if separator.length > 1
|
10
|
-
separator = separator[0]
|
11
|
-
end
|
11
|
+
separator = separator[0] if separator.length > 1
|
12
12
|
string = self
|
13
13
|
string = string.reverse
|
14
14
|
array = string.scan(/.{1,#{count}}/)
|
15
15
|
string = array.join(separator)
|
16
16
|
string = string.reverse
|
17
|
-
|
17
|
+
|
18
|
+
string
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string-utility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
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-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
Some simple but handy methods to interact with string objects.
|
13
|
+
description: " Some simple but handy methods to interact with string objects.\n"
|
15
14
|
email: elifosterwy@gmail.com
|
16
15
|
executables: []
|
17
16
|
extensions: []
|