blackstack_commons 1.1.40 → 1.1.44

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: 56845620e1eb854129f21d7bcc71bd7246cc3ef5
4
- data.tar.gz: 67d73bb64e3c2e2b2157249fd23a2000cfcd39ce
3
+ metadata.gz: af627626dd5cab004774299caee7665e952fb547
4
+ data.tar.gz: 2a9d96e2c05e971528015a01dfb53a1beeb038cf
5
5
  SHA512:
6
- metadata.gz: f1637f9e742b5bbe7c6df3ef1d83d3917b33896f016bd56b171a46f4611f8fa28308be8d15b3a714b37e15854463c506af71828aaec3a96f13b278d7ae7c2935
7
- data.tar.gz: ccc0a9d82965d4464d22ea19d3129c18439699f9acd8fb537da3b44c1ed53101da58c55c841242cf96042c31862404334c8925bc1e9d7d05849ba4ab79d3ba2c
6
+ metadata.gz: 9ff40e6c37b33d171adbf310779c55386f89105d2509d9fc6a9f87e7ec58e6f4bf06ef263fe6837c6c8a229e3631f6900dd3f27f996700b7207bc16dc1686fe0
7
+ data.tar.gz: 9e6f8aeff75ef5bb189dbb6da813b13c9c979d97fc7d411312f3d833c1ea3bcd3586405df18ce7326474040e0dad92b35f92b058e19b4d9df72ae17bd0b12c25
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  require 'content_spinning'
2
3
  require 'uri'
3
4
  require 'json'
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
- js_escape_map = { '\\' => '\\\\', "</" => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'", "`" => "\\`", "$" => "\\$" }
116
- js_escape_map.each { | x, y | s.gsub!(x,y) }
117
- s
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,4}/
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.40
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-01-15 00:00:00.000000000 Z
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: []