Module: Byebug::EnableDisableFunctions
- Defined in:
- lib/byebug/commands/enable.rb
Overview
Mixin to assist command parsing
Instance Method Summary collapse
- #enable_disable_breakpoints(is_enable, args) ⇒ Object
- #enable_disable_display(is_enable, args) ⇒ Object
Instance Method Details
#enable_disable_breakpoints(is_enable, args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/byebug/commands/enable.rb', line 6 def enable_disable_breakpoints(is_enable, args) return errmsg "No breakpoints have been set" if Byebug.breakpoints.empty? all_breakpoints = Byebug.breakpoints.sort_by {|b| b.id } if args.empty? selected_breakpoints = all_breakpoints else selected_ids = [] args.each do |pos| pos = get_int(pos, "#{is_enable} breakpoints", 1, all_breakpoints.last.id) return nil unless pos selected_ids << pos end selected_breakpoints = all_breakpoints.select { |b| selected_ids.include?(b.id) } end selected_breakpoints.each do |b| enabled = ('enable' == is_enable) if enabled && !syntax_valid?(b.expr) errmsg "Expression \"#{b.expr}\" syntactically incorrect; " \ "breakpoint remains disabled.\n" else b.enabled = enabled end end end |
#enable_disable_display(is_enable, args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/byebug/commands/enable.rb', line 34 def enable_disable_display(is_enable, args) if 0 == @state.display.size return errmsg "No display expressions have been set\n" end args.each do |pos| pos = get_int(pos, "#{is_enable} display", 1, @state.display.size) return nil unless pos @state.display[pos-1][0] = ('enable' == is_enable) end end |