Class: DEBUGGER__::MethodBreakpoint
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Breakpoint
|
|
Instance Chain:
|
|
Inherits: |
DEBUGGER__::Breakpoint
|
Defined in: | lib/debug/breakpoint.rb |
Class Method Summary
- .new(b, klass_name, op, method_name, cond: nil, command: nil, path: nil) ⇒ MethodBreakpoint constructor
Breakpoint
- Inherited
Instance Attribute Summary
- #klass readonly
- #method readonly
- #sig_method_name readonly
Breakpoint
- Inherited
Instance Method Summary
- #enable
- #eval_class_name
-
#override(klass)
See additional method definition at line 480.
- #search_method
- #setup
- #sig
- #to_s
- #try_enable(added: false)
Breakpoint
- Inherited
#delete, #description, #disable, #enable, #generate_label, #safe_eval, #setup, #skip_path?, #suspend, #to_s |
Color
- Included
#color_pp | See additional method definition at line 50. |
#colored_inspect, | |
#colorize | See additional method definition at line 36. |
#colorize_blue, | |
#colorize_code | See additional method definition at line 79. |
#colorize_cyan, #colorize_dim, #colorize_magenta, | |
#irb_colorize | See additional method definition at line 27. |
#with_inspection_error_guard |
SkipPathHelper
- Included
Constructor Details
.new(b, klass_name, op, method_name, cond: nil, command: nil, path: nil) ⇒ MethodBreakpoint
# File 'lib/debug/breakpoint.rb', line 430
def initialize b, klass_name, op, method_name, cond: nil, command: nil, path: nil @sig_klass_name = klass_name @sig_op = op @sig_method_name = method_name @klass_eval_binding = b @override_method = false @klass = nil @method = nil @cond_class = nil @key = "#{klass_name}#{op}#{method_name}".freeze super(cond, command, path, do_enable: false) end
Instance Attribute Details
#klass (readonly)
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 428
attr_reader :sig_method_name, :method, :klass
#method (readonly)
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 428
attr_reader :sig_method_name, :method, :klass
#sig_method_name (readonly)
[ GitHub ]Instance Method Details
#enable
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 475
def enable try_enable end
#eval_class_name
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 457
def eval_class_name return @klass if @klass @klass = @klass_eval_binding.eval(@sig_klass_name) @klass_eval_binding = nil @klass end
#override(klass)
See additional method definition at line 480.
# File 'lib/debug/breakpoint.rb', line 489
def override klass sig_method_name = @sig_method_name klass.prepend Module.new{ define_method(sig_method_name) do |*args, &block| super(*args, &block) end } end
#search_method
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 464
def search_method case @sig_op when '.' @method = @klass.method(@sig_method_name) when '#' @method = @klass.instance_method(@sig_method_name) else raise "Unknown op: #{@sig_op}" end end
#setup
[ GitHub ]#sig
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 543
def sig @key end
#to_s
[ GitHub ]#try_enable(added: false)
[ GitHub ]# File 'lib/debug/breakpoint.rb', line 499
def try_enable added: false eval_class_name search_method begin retried = false @tp.enable(target: @method) DEBUGGER__.info "#{self} is activated." if added if @sig_op == '#' @cond_class = @klass if @method.owner != @klass else # '.' begin @cond_class = @klass.singleton_class if @method.owner != @klass.singleton_class rescue TypeError end end rescue ArgumentError raise if retried retried = true # maybe C method case @sig_op when '.' begin override @klass.singleton_class rescue TypeError override @klass.class end when '#' override @klass end # re-collect the method object after the above patch search_method @override_method = true if @method retry end rescue Exception raise unless added end