⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (529 Bytes)
Bug #13369
» tracepoint-bug-example.rb
backus (John Backus)
, 03/27/2017 05:49 AM
class
Foo
MyError
=
Class
.
new
(
StandardError
)
def
example1
norf
rescue
MyError
=>
error
2
end
def
example2
norf
rescue
MyError
=>
error
return
2
end
def
norf
raise
MyError
end
end
trace
=
TracePoint
.
new
(
:return
)
do
|
tp
|
puts
"
#{
tp
.
defined_class
}
#
#{
tp
.
method_id
}
RETURNS
#{
tp
.
return_value
.
inspect
}
"
end
trace
.
enable
Foo
.
new
.
example1
# => 2
puts
Foo
.
new
.
example2
# => 2
# >> Foo#norf RETURNS nil
# >> Foo#example1 RETURNS 2
# >>
# >> Foo#norf RETURNS nil
# >> Foo#example2 RETURNS nil
« Previous
1
2
Next »
(1-1/2)
Loading...