Sha256: 328522268b17d8990d24c978dfdbded06641f7d9d84045dd849a5079c2065038
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
module Debugger class Command class << self def commands @commands ||= [] end def inherited(klass) klass.instance_variable_set("@event", klass.instance_variable_get("@event") || true) klass.instance_variable_set("@control", klass.instance_variable_get("@control") || false) commands << klass end def load_commands dir = File.dirname(__FILE__) Dir[File.join(dir, 'commands', '*')].each do |file| require file end end attr_accessor :control attr_accessor :event end def initialize(state) @state = state end def match(input) @match = regexp.match(input) end protected def print(*args) @state.print(*args) end def confirm(msg) @state.confirm(msg) == 'y' end def debug_eval(str) begin val = eval(str, @state.binding) rescue StandardError, ScriptError => e at = eval("caller(1)", @state.binding) print "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') for i in at print "\tfrom %s\n", i end throw :debug_error end end def debug_silent_eval(str) begin eval(str, @state.binding) rescue StandardError, ScriptError nil end end def line_at(file, line) Debugger.line_at(file, line) end def get_context(thnum) Debugger.contexts.find{|c| c.thnum == thnum} end end Command.load_commands end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-debug-0.3-mswin32 | lib/ruby-debug/command.rb |
ruby-debug-0.3 | lib/ruby-debug/command.rb |