blackstack_commons 1.1.40 → 1.1.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blackstack_commons.rb +1 -0
- data/lib/extend_string.rb +26 -3
- data/lib/functions.rb +33 -3
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af627626dd5cab004774299caee7665e952fb547
|
4
|
+
data.tar.gz: 2a9d96e2c05e971528015a01dfb53a1beeb038cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ff40e6c37b33d171adbf310779c55386f89105d2509d9fc6a9f87e7ec58e6f4bf06ef263fe6837c6c8a229e3631f6900dd3f27f996700b7207bc16dc1686fe0
|
7
|
+
data.tar.gz: 9e6f8aeff75ef5bb189dbb6da813b13c9c979d97fc7d411312f3d833c1ea3bcd3586405df18ce7326474040e0dad92b35f92b058e19b4d9df72ae17bd0b12c25
|
data/lib/blackstack_commons.rb
CHANGED
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
@@ -1,6 +1,34 @@
|
|
1
1
|
|
2
2
|
module BlackStack
|
3
3
|
|
4
|
+
# -----------------------------------------------------------------------------------------
|
5
|
+
# PRY Supporting Functions
|
6
|
+
# -----------------------------------------------------------------------------------------
|
7
|
+
module Debugging
|
8
|
+
@@allow_breakpoints = false
|
9
|
+
|
10
|
+
# return true if breakpoints are allowed
|
11
|
+
def self.allow_breakpoints
|
12
|
+
@@allow_breakpoints
|
13
|
+
end
|
14
|
+
|
15
|
+
# set breakpoints allowed if the hash contains a key :allow_breakpoints with a value of true
|
16
|
+
def self.set(h)
|
17
|
+
@@allow_breakpoints = h[:allow_breakpoints] if h[:allow_breakpoints].is_a?(TrueClass)
|
18
|
+
end
|
19
|
+
|
20
|
+
# BlackStack::Debugging.breakpoint can be invoked in the middle of a running program.
|
21
|
+
# It opens a Pry session at the point it's called and makes all program state at that point available.
|
22
|
+
# When the session ends the program continues with any modifications you made to it.
|
23
|
+
#
|
24
|
+
# BlackStack::Debugging.breakpoint is just calling the Pry's `binding.pry` method, but only if the @@allow_breakpoints is true.
|
25
|
+
#
|
26
|
+
def self.breakpoint()
|
27
|
+
# start a REPL session, if breakpoints are allowed
|
28
|
+
binding.pry if @@allow_breakpoints
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
4
32
|
# -----------------------------------------------------------------------------------------
|
5
33
|
# OCRA Supporting Functions
|
6
34
|
# -----------------------------------------------------------------------------------------
|
@@ -121,7 +149,7 @@ module BlackStack
|
|
121
149
|
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
150
|
MATCH_FILENAME = /[\w\-\_\.]+/
|
123
151
|
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,
|
152
|
+
MATCH_DOMAIN = /(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,10}/
|
125
153
|
MATCH_DATE_STANDARD = /\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])/
|
126
154
|
MATCH_PHONE = /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
|
127
155
|
MATCH_URL = /(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ # /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
|
@@ -369,13 +397,15 @@ module BlackStack
|
|
369
397
|
return false if n>1 # Opening spining char '{' inside another spining block.
|
370
398
|
end
|
371
399
|
}
|
372
|
-
|
400
|
+
|
401
|
+
return false if n!=0
|
402
|
+
|
373
403
|
# obtengo cada uno de los spinnings
|
374
404
|
s.scan(MATCH_CONTENT_SPINNING).each { |x|
|
375
405
|
a = x.split('|')
|
376
406
|
raise "No variations delimited by '|' inside spinning block." if a.size <= 1
|
377
407
|
}
|
378
|
-
|
408
|
+
|
379
409
|
true
|
380
410
|
end
|
381
411
|
|
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.44
|
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: 2021-
|
11
|
+
date: 2021-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: content_spinning
|
@@ -50,6 +50,26 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.8.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: pry
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.14.1
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.14.1
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.14.1
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.14.1
|
53
73
|
description: 'THIS GEM IS STILL IN DEVELOPMENT STAGE. Find documentation here: https://github.com/leandrosardi/blackstack_commons.'
|
54
74
|
email: leandro.sardi@expandedventure.com
|
55
75
|
executables: []
|