pretty_strings 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pretty_strings/version.rb +1 -1
- data/lib/pretty_strings.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3903bf68c19e20283baaaeca3d44b71683ba5e22
|
4
|
+
data.tar.gz: c1d39e2f09f3a43dc60c7779cd1a8d8decc694b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba83e084eb1ef9077aedbbf89cbecb022d174755dc6fa455315cf4dbaac27208a85453d452abc25b5afd64ad4b350ae4e33505c9e6557da6e463dcdc34937c6
|
7
|
+
data.tar.gz: a107bf2676f8426f87f25adc9f4104a30a59a691dd05fc77c7d3d6e670238b1109e757abe4ac5d2ef1971ca208a2ee5e49d2753ef8cc1750f90975b58dd5045a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Pretty Strings
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/pretty_strings) [](https://travis-ci.org/diasks2/pretty_strings) [](https://github.com/diasks2/pretty_strings/blob/master/LICENSE.txt)
|
4
4
|
|
data/lib/pretty_strings.rb
CHANGED
@@ -10,7 +10,8 @@ module PrettyStrings
|
|
10
10
|
|
11
11
|
def pretty
|
12
12
|
return '' if text.nil? || text.empty?
|
13
|
-
|
13
|
+
remove_bracketed_numbers(
|
14
|
+
replace_symbol_with_bracket(
|
14
15
|
remove_newlines(
|
15
16
|
replace_tabs(
|
16
17
|
remove_bracketed_code(
|
@@ -22,7 +23,7 @@ module PrettyStrings
|
|
22
23
|
sanitize_text(
|
23
24
|
replace_bracket_with_symbol(
|
24
25
|
text
|
25
|
-
))))))))))).squeeze(" ").strip
|
26
|
+
)))))))))))).squeeze(" ").strip
|
26
27
|
end
|
27
28
|
|
28
29
|
private
|
@@ -37,7 +38,17 @@ module PrettyStrings
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def remove_bracketed_code(text)
|
41
|
+
text.gsub!(/(?<=\*\*)\{(?=date\}\*\*)/, '⚘') || text
|
42
|
+
text.gsub!(/(?<=\*\*)\{(?=number\}\*\*)/, '⚘') || text
|
43
|
+
text.gsub!(/(?<=\*\*)\{(?=email\}\*\*)/, '⚘') || text
|
44
|
+
text.gsub!(/(?<=\*\*)\{(?=url\}\*\*)/, '⚘') || text
|
45
|
+
text.gsub!(/(?<=\*\*\{date)\}(?=\*\*)/, '♚') || text
|
46
|
+
text.gsub!(/(?<=\*\*\{number)\}(?=\*\*)/, '♚') || text
|
47
|
+
text.gsub!(/(?<=\*\*\{email)\}(?=\*\*)/, '♚') || text
|
48
|
+
text.gsub!(/(?<=\*\*\{url)\}(?=\*\*)/, '♚') || text
|
40
49
|
text.gsub!(/\{.*?\}/, '') || text
|
50
|
+
text.gsub!(/♚/, '}') || text
|
51
|
+
text.gsub!(/⚘/, '{') || text
|
41
52
|
end
|
42
53
|
|
43
54
|
def replace_bracket_with_symbol(text)
|
@@ -48,6 +59,10 @@ module PrettyStrings
|
|
48
59
|
text.gsub!(/♳/, '<') || text
|
49
60
|
end
|
50
61
|
|
62
|
+
def remove_bracketed_numbers(text)
|
63
|
+
text.gsub!(/\<\d+\>/, '') || text
|
64
|
+
end
|
65
|
+
|
51
66
|
def escape_text(text)
|
52
67
|
CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(text))))
|
53
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_strings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin S. Dias
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-html-sanitizer
|