Class: PryExceptionExplorer::Intercept
- Defined in:
- lib/pry-exception_explorer/intercept.rb
Instance Attribute Summary collapse
-
#block ⇒ Proc
readonly
The predicate block that determines if interception takes place.
-
#skip_num ⇒ Fixnum
readonly
Number of frames to skip when session starts.
-
#skip_until_block ⇒ Proc
readonly
The block that determines when to stop skipping frames.
-
#skip_while_block ⇒ Proc
readonly
The block that defines the frames to skip.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Whether this intercept object is active If it's inactive then calling it will always return
false
regardless of content inside block. -
#call(*args) ⇒ Boolean
Invoke the associated block for this
PryExceptionExplorer::Intercept
object. -
#disable! ⇒ PryExceptionExplorer::Intercept
Disable the intercept object.
-
#enable! ⇒ PryExceptionExplorer::Intercept
Enable if the intercept object.
-
#initialize(block) ⇒ Intercept
constructor
A new instance of Intercept.
-
#intercept_recurse(should_recurse) ⇒ PryExceptionExplorer::Intercept
The receiver.
-
#intercept_recurse? ⇒ Boolean
Whether exceptions raised inside the session will be intercepted.
-
#skip(num) ⇒ PryExceptionExplorer::Intercept
The receiver.
-
#skip_until {|lazy_frame| ... } ⇒ PryExceptionExplorer::Intercept
The receiver.
-
#skip_while {|lazy_frame| ... } ⇒ PryExceptionExplorer::Intercept
The receiver.
Constructor Details
#initialize(block) ⇒ Intercept
Returns a new instance of Intercept.
60 61 62 63 64 65 66 |
# File 'lib/pry-exception_explorer/intercept.rb', line 60 def initialize(block) skip(0) intercept_recurse(false) @block = block @active = true end |
Instance Attribute Details
#block ⇒ Proc (readonly)
Returns The predicate block that determines if interception takes place.
6 7 8 |
# File 'lib/pry-exception_explorer/intercept.rb', line 6 def block @block end |
#skip_num ⇒ Fixnum (readonly)
Returns Number of frames to skip when session starts.
9 10 11 |
# File 'lib/pry-exception_explorer/intercept.rb', line 9 def skip_num @skip_num end |
#skip_until_block ⇒ Proc (readonly)
Returns The block that determines when to stop skipping frames.
15 16 17 |
# File 'lib/pry-exception_explorer/intercept.rb', line 15 def skip_until_block @skip_until_block end |
#skip_while_block ⇒ Proc (readonly)
Returns The block that defines the frames to skip.
12 13 14 |
# File 'lib/pry-exception_explorer/intercept.rb', line 12 def skip_while_block @skip_while_block end |
Instance Method Details
#active? ⇒ Boolean
Returns Whether this intercept object is active
If it's inactive then calling it will always return false
regardless of content inside block.
20 |
# File 'lib/pry-exception_explorer/intercept.rb', line 20 def active?() !!@active end |
#call(*args) ⇒ Boolean
Invoke the associated block for this
PryExceptionExplorer::Intercept
object. Note that the block is
not invoked if the intercept object is inactive.
73 74 75 |
# File 'lib/pry-exception_explorer/intercept.rb', line 73 def call(*args) active? && @block.call(*args) end |
#disable! ⇒ PryExceptionExplorer::Intercept
Disable the intercept object.
24 |
# File 'lib/pry-exception_explorer/intercept.rb', line 24 def disable!() tap { @active = false } end |
#enable! ⇒ PryExceptionExplorer::Intercept
Enable if the intercept object.
28 |
# File 'lib/pry-exception_explorer/intercept.rb', line 28 def enable!() tap { @active = true } end |
#intercept_recurse(should_recurse) ⇒ PryExceptionExplorer::Intercept
Returns The receiver.
54 |
# File 'lib/pry-exception_explorer/intercept.rb', line 54 def intercept_recurse(should_recurse) tap { @intercept_recurse = should_recurse } end |
#intercept_recurse? ⇒ Boolean
Returns Whether exceptions raised inside the session will be intercepted.
58 |
# File 'lib/pry-exception_explorer/intercept.rb', line 58 def intercept_recurse?() !!@intercept_recurse end |
#skip(num) ⇒ PryExceptionExplorer::Intercept
Returns The receiver.
33 |
# File 'lib/pry-exception_explorer/intercept.rb', line 33 def skip(num) tap { @skip_num = num } end |
#skip_until {|lazy_frame| ... } ⇒ PryExceptionExplorer::Intercept
Returns The receiver.
49 |
# File 'lib/pry-exception_explorer/intercept.rb', line 49 def skip_until(&block) tap { @skip_until_block = block } end |
#skip_while {|lazy_frame| ... } ⇒ PryExceptionExplorer::Intercept
Returns The receiver.
41 |
# File 'lib/pry-exception_explorer/intercept.rb', line 41 def skip_while(&block) tap { @skip_while_block = block } end |