Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
set_trace_func for Rubinius
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
lib Get this minimally working for current rubinius. It also exhibits the…
test
.gitignore Get this minimally working for current rubinius. It also exhibits the…
ChangeLog
LICENSE
NEWS
README.textile
Rakefile
THANKS
rbx-tracer.gemspec

README.textile

Simulate Ruby 1.8, 1.9, JRuby’s set_trace_func and SCRIPT_LINES__ in Rubinius.

What is method Kernel#set_trace_func and constant SCRIPT_LINES___ ?

set_trace_func(proc) establishes proc as the handler for tracing or disables tracing if the parameter is nil.

if constaint __SCRIPT_LINES____ is defined and references a Hash, Ruby will store an entry containing the contents of each Ruby file it loads. The key for each hash entry is the file loaded as given by Ruby meta-constant “FILE” and the value is an Array of Strings with newlines containing the file contents.

Example of set_trace_func :

   require 'rubygems'; require 'set_trace'
   meth = lambda { |event, file, line, id, binding, classname|
     puts "tracer: #{event} #{file}:#{line}"
   }
   set_trace_func meth

Example of SCRIPT_LINES__ :

   require 'rubygems'; require 'script_lines'
   SCRIPT_LINES__ = {}
   load 'foo.rb'
   # SCRIPT_LINES__ should have 'foo.rb' as a key and file contents as an Array
   # if it the 'foo.rb' loaded successfully.
Something went wrong with that request. Please try again.