Skip to content

Instantly share code, notes, and snippets.

@duckinator
Created January 16, 2013 22:54
Show Gist options
  • Save duckinator/4551735 to your computer and use it in GitHub Desktop.
Save duckinator/4551735 to your computer and use it in GitHub Desktop.
[..inator/ruby-hashdec/tests]$ ./trace.rb
Entering test(1)
In test()
Leaving test (returned nil)
[..inator/ruby-hashdec/tests]$
#!/usr/bin/env ruby
require '../lib/hashdec.rb'
# FIXME: Make it work with test(*args)
module HashDec
def self.trace(ba, function, hashdec_args, args, ret)
case ba
when :before
puts "Entering #{function}(#{args.map(&:inspect).join(', ')})"
when :after
puts "Leaving #{function} (returned #{ret.inspect})"
end
end
end
#trace()
def test(arg)
puts "In test()"
end
test 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment