finishing_moves 0.14 → 0.15
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/README.md +1 -0
- data/lib/finishing_moves/string.rb +10 -6
- data/lib/finishing_moves/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e36f55195a69cb9de0d770520eb85dcae3c37e77
|
|
4
|
+
data.tar.gz: 92a7b57e0cd6e5a3eb589b5b4e67cf997689f1c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42a4403be772317ccec7afadf3b370e7274c0d484de64d536eee85f916b6aa0d8ef853f1753ab7e40828f1dc538b18eb1935e7d9d74ed51bcd554a9e76df3328
|
|
7
|
+
data.tar.gz: 8dfdc2bf9b947602b28cf8cde6c4b767dbb466711db5193b34ce59ee6b4142bc0cec2663832f91047b20d2e8c993b5a84603030c3d777bcdca9ab8b50a3f7b77
|
data/README.md
CHANGED
|
@@ -51,6 +51,7 @@ gem install 'finishing_moves'
|
|
|
51
51
|
- [`String#nl2br`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnl2br)
|
|
52
52
|
- [`String#numeric?`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnumeric) :boom:
|
|
53
53
|
- [`String#remove_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringremove_whitespace)
|
|
54
|
+
- [`String#replace_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringreplace_whitespace)
|
|
54
55
|
- [`String#strip_all`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringstrip_all) :boom:
|
|
55
56
|
|
|
56
57
|
*Multi-class logic enhancements*
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
class String
|
|
2
2
|
|
|
3
3
|
def nl2br
|
|
4
|
-
|
|
4
|
+
gsub _nl_gsub_regex, "<br />\n"
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def newline_to(rep = ' ')
|
|
8
|
-
|
|
8
|
+
gsub _nl_gsub_regex, rep.to_s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def newline_to!(rep = ' ')
|
|
12
|
+
gsub! _nl_gsub_regex, rep.to_s
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
def keyify
|
|
@@ -99,15 +103,15 @@ class String
|
|
|
99
103
|
end
|
|
100
104
|
|
|
101
105
|
# TODO
|
|
102
|
-
def each_char_index(&block)
|
|
106
|
+
# def each_char_index(&block)
|
|
103
107
|
# how to return enumerator if no block given?
|
|
104
108
|
# http://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/
|
|
105
|
-
end
|
|
109
|
+
# end
|
|
106
110
|
|
|
107
111
|
protected
|
|
108
112
|
|
|
109
|
-
def
|
|
110
|
-
|
|
113
|
+
def _nl_gsub_regex
|
|
114
|
+
/(?:\n\r?|\r\n?)/
|
|
111
115
|
end
|
|
112
116
|
|
|
113
117
|
def _lstrip_all_regex(expr)
|