blackstack_commons 1.1.44 → 1.1.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions.rb +14 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af627626dd5cab004774299caee7665e952fb547
4
- data.tar.gz: 2a9d96e2c05e971528015a01dfb53a1beeb038cf
3
+ metadata.gz: 78fbaedcc54afdcf8afc8b911be0b2dabd1a1a09
4
+ data.tar.gz: f96e8330817679e7db3eddca99003ca56f46b51d
5
5
  SHA512:
6
- metadata.gz: 9ff40e6c37b33d171adbf310779c55386f89105d2509d9fc6a9f87e7ec58e6f4bf06ef263fe6837c6c8a229e3631f6900dd3f27f996700b7207bc16dc1686fe0
7
- data.tar.gz: 9e6f8aeff75ef5bb189dbb6da813b13c9c979d97fc7d411312f3d833c1ea3bcd3586405df18ce7326474040e0dad92b35f92b058e19b4d9df72ae17bd0b12c25
6
+ metadata.gz: 03360144799b037c7ac529fabb6e84d90994812df8c3f8e172287d7357458f932fc4a2cf38d29e50a57ddac7cfbcca7bccb28c8758efeff416ca485f534adf72
7
+ data.tar.gz: 61a37703f38eb16749a708255a9f948d24119c50b2f77682af847d04953cd1bf562652970fa4e3fabeede949a55e91dc303c3812e886e76247592bb981e08c7b
data/lib/functions.rb CHANGED
@@ -6,7 +6,8 @@ module BlackStack
6
6
  # -----------------------------------------------------------------------------------------
7
7
  module Debugging
8
8
  @@allow_breakpoints = false
9
-
9
+ @@verbose = false
10
+
10
11
  # return true if breakpoints are allowed
11
12
  def self.allow_breakpoints
12
13
  @@allow_breakpoints
@@ -15,17 +16,19 @@ module BlackStack
15
16
  # set breakpoints allowed if the hash contains a key :allow_breakpoints with a value of true
16
17
  def self.set(h)
17
18
  @@allow_breakpoints = h[:allow_breakpoints] if h[:allow_breakpoints].is_a?(TrueClass)
18
- end
19
+ @@verbose = h[:verbose] if h[:verbose].is_a?(TrueClass)
19
20
 
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
21
+ if !@@allow_breakpoints
22
+ # monkey patching the pry method to not break on breakpoints
23
+ new_pry = lambda do
24
+ print "Breakpoint are not allowed" if @@verbose
25
+ end
26
+
27
+ Binding.class_eval do
28
+ alias_method :old_pry, :pry
29
+ define_method :pry, new_pry
30
+ end
31
+ end
29
32
  end
30
33
  end
31
34
 
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.44
4
+ version: 1.1.45
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-10-30 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: content_spinning