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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ceb2c2bcfb8ec02804010dbcb06583855e68dbb9
4
- data.tar.gz: 88aa3f8fa7d2ad318cea2236db6f0b56fd870d84
3
+ metadata.gz: 3903bf68c19e20283baaaeca3d44b71683ba5e22
4
+ data.tar.gz: c1d39e2f09f3a43dc60c7779cd1a8d8decc694b9
5
5
  SHA512:
6
- metadata.gz: 02d994529f05619874a3c5f2dcd4f22121bfa2d7684f3ee5462411bbc05aecb593d20b0f7d442e01fd5386bc45dcbc6c66ed76b07246595dc9720c6ad0a58cca
7
- data.tar.gz: 5d6641aa71590d74e02d2fa7314ce3e1c290355b779c10025970e7145a20dd81861e7fb0d33fd69ea8335f1129182d3d9e014bb0f820819b92e0c2fbe4382b91
6
+ metadata.gz: bba83e084eb1ef9077aedbbf89cbecb022d174755dc6fa455315cf4dbaac27208a85453d452abc25b5afd64ad4b350ae4e33505c9e6557da6e463dcdc34937c6
7
+ data.tar.gz: a107bf2676f8426f87f25adc9f4104a30a59a691dd05fc77c7d3d6e670238b1109e757abe4ac5d2ef1971ca208a2ee5e49d2753ef8cc1750f90975b58dd5045a
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # PrettyStrings
1
+ # Pretty Strings
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/pretty_strings.svg)](https://badge.fury.io/rb/pretty_strings) [![Build Status](https://travis-ci.org/diasks2/pretty_strings.png)](https://travis-ci.org/diasks2/pretty_strings) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/diasks2/pretty_strings/blob/master/LICENSE.txt)
4
4
 
@@ -1,3 +1,3 @@
1
1
  module PrettyStrings
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -10,7 +10,8 @@ module PrettyStrings
10
10
 
11
11
  def pretty
12
12
  return '' if text.nil? || text.empty?
13
- replace_symbol_with_bracket(
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.1.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-13 00:00:00.000000000 Z
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