Sha256: e72f31a5b1a7849f29cee5067b6af6ff2cddb7eccc2fe26c802c0f3f85598f6c
Contents?: true
Size: 1.91 KB
Versions: 4
Compression:
Stored size: 1.91 KB
Contents
module Debugger class Command # :nodoc: class << self def commands @commands ||= [] end DEF_OPTIONS = { :event => true, :control => false, :always_run => false, :unknown => false, :context => false, } def inherited(klass) DEF_OPTIONS.each do |o, v| klass.options[o] = v if klass.options[o].nil? end commands << klass end def load_commands dir = File.dirname(__FILE__) Dir[File.join(dir, 'commands', '*')].each do |file| require file if file =~ /\.rb$/ end end def method_missing(meth, *args, &block) if meth.to_s =~ /^(.+?)=$/ @options[$1.intern] = args.first else if @options.has_key?(meth) @options[meth] else super end end end def options @options ||= {} end 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-debug-0.5.1-mswin32 | lib/ruby-debug/command.rb |
ruby-debug-0.5-mswin32 | lib/ruby-debug/command.rb |
ruby-debug-0.5.1 | lib/ruby-debug/command.rb |
ruby-debug-0.5 | lib/ruby-debug/command.rb |