blackstack_commons 1.1.39 → 1.1.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/extend_string.rb +26 -3
- data/lib/functions.rb +6 -4
- 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: fea045fbb95c6711f478a1a55c0be53aa80358c5
|
4
|
+
data.tar.gz: ef7365454f7635ee90b2d0a222c6e2c6e40f5139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e5d5254b58e2230a93ddd32b5ea42de658ebf075af6f91148e6035f640de5ad00aea96e63f68d02b08e21cbd4b9a20928bf0aa0b27aff667581287a3b78fcc
|
7
|
+
data.tar.gz: c6883e896e9805a3351be11370118170a9bb546b386edd3478d371f86e5469bcae2472eb6262a34f4381413eb126f65a7d379043ca3ae9e5b2ed520d4ccdfc36
|
data/lib/extend_string.rb
CHANGED
@@ -110,11 +110,34 @@ class String
|
|
110
110
|
|
111
111
|
# Escapes carriage returns and single and double quotes for JavaScript segments.
|
112
112
|
# reference: https://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html
|
113
|
+
#
|
114
|
+
# Example:
|
115
|
+
# <%
|
116
|
+
# s = 'Hello World!'
|
117
|
+
# %>
|
118
|
+
# text = "<%=s.escape_javascript%>"
|
119
|
+
#
|
120
|
+
# Never use single-quotation marks, because this method is not supporting it.
|
121
|
+
# <%
|
122
|
+
# s = 'Hello World!'
|
123
|
+
# %>
|
124
|
+
# text = '<%=s.escape_javascript%>'
|
125
|
+
#
|
113
126
|
def escape_javascript
|
114
127
|
s = self.dup
|
115
|
-
|
116
|
-
|
117
|
-
|
128
|
+
js_escape_map = {
|
129
|
+
'\\' => '\\\\',
|
130
|
+
"</" => '<\/',
|
131
|
+
"\r\n" => '\n',
|
132
|
+
"\n" => '\n',
|
133
|
+
"\r" => '\n',
|
134
|
+
'"' => '\\"',
|
135
|
+
"'" => "\'",
|
136
|
+
"`" => "\`",
|
137
|
+
"$" => "\\$",
|
138
|
+
}
|
139
|
+
js_escape_map.each { | x, y | s.gsub!(x,y) }
|
140
|
+
s
|
118
141
|
end
|
119
142
|
|
120
143
|
end # class String
|
data/lib/functions.rb
CHANGED
@@ -120,8 +120,8 @@ module BlackStack
|
|
120
120
|
MATCH_PASSWORD = /(?=.*[a-zA-Z])(?=.*[0-9]).{6,}/
|
121
121
|
MATCH_GUID = /{?[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]}?/
|
122
122
|
MATCH_FILENAME = /[\w\-\_\.]+/
|
123
|
-
MATCH_EMAIL = /[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{
|
124
|
-
MATCH_DOMAIN = /(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,
|
123
|
+
MATCH_EMAIL = /[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{1,25}/
|
124
|
+
MATCH_DOMAIN = /(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,10}/
|
125
125
|
MATCH_DATE_STANDARD = /\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])/
|
126
126
|
MATCH_PHONE = /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
|
127
127
|
MATCH_URL = /(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ # /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
|
@@ -369,13 +369,15 @@ module BlackStack
|
|
369
369
|
return false if n>1 # Opening spining char '{' inside another spining block.
|
370
370
|
end
|
371
371
|
}
|
372
|
-
|
372
|
+
|
373
|
+
return false if n!=0
|
374
|
+
|
373
375
|
# obtengo cada uno de los spinnings
|
374
376
|
s.scan(MATCH_CONTENT_SPINNING).each { |x|
|
375
377
|
a = x.split('|')
|
376
378
|
raise "No variations delimited by '|' inside spinning block." if a.size <= 1
|
377
379
|
}
|
378
|
-
|
380
|
+
|
379
381
|
true
|
380
382
|
end
|
381
383
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: content_spinning
|