Sha256: 7fbde20e5363b4d7f9bbc3f7cb8e4724bc5c0618b35ed85fb552b17cabeecc94

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

$debug = true
if $debug
	warn 'DEBUG MODE'
	
	#require 'ruby-debug'
	
	Thread.abort_on_exception = true
	
	RubyExt::ClassLoader.error_on_defined_constant = true
	
	module Kernel
		STACK_TRACE_EXCLUDE = [
		/\/rspec/, 
		/\/ruby-debug/, 
		/\/monitor.rb/, 
		/\/timeout.rb/,
#				/gems/, 
		#		/WGUI/,
		/\/MicroContainer/,
		/\/RubyExt/,
		/\/kernel.rb/,
		/\/mongrel/,
		/\/rack/,
		/\/sync/,
		/\/require/,
		/\/site_ruby/,
		/OpenConstructor/,
		]
		
		alias_method :old_caller, :caller
		def caller int = 0
			stack = old_caller  
			stack = stack[(int+1)..stack.size].delete_if do |line|
				STACK_TRACE_EXCLUDE.any?{|re| line =~ re}
			end
			return stack
		end
		
		def where?
			puts "\nwhere:"
			puts caller
		end
		
#		alias_method :old_raise, :raise
#		def raise *p
#			case p.size
#				when 3
#				e, m, c = p
#				when 2
#				e, m = p
#				c = caller
#				when 1					
#				if p[0].is_a? Exception
#					e = p[0].class
#					m = p[0].message					
#				else
#					e = RuntimeError
#					m = p[0]				
#				end
#				c = caller
#				when 0
#				e, m, c = RuntimeError, "", caller
#			else 
#				old_raise "Invalid Usage!"
#			end
#			old_raise e, m, c
#		end
	end				
end
#def p; end
#def puts; end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
ruby-ext-0.2.16 old/lib/RubyExt/debug.rb
ruby-ext-0.2.15 old/lib/RubyExt/debug.rb
ruby-ext-0.2.13 old/lib/RubyExt/debug.rb
ruby-ext-0.2.12 old/lib/RubyExt/debug.rb
ruby-ext-0.2.11 old/lib/RubyExt/debug.rb
ruby-ext-0.2.10 old/lib/RubyExt/debug.rb
ruby-ext-0.2.9 old/lib/RubyExt/debug.rb
ruby-ext-0.2.8 old/lib/RubyExt/debug.rb
ruby-ext-0.2.7 old/lib/RubyExt/debug.rb
ruby-ext-0.2.6 old/lib/RubyExt/debug.rb
ruby-ext-0.2.5 old/lib/RubyExt/debug.rb
ruby-ext-0.2.4 old/lib/RubyExt/debug.rb
ruby-ext-0.2.3 old/lib/RubyExt/debug.rb
RubyExt-0.1.1 lib/RubyExt/debug.rb
RubyExt-0.1.2 lib/RubyExt/debug.rb