⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (791 Bytes)
Bug #16383
» trace_point_issue.rb
contains code sample to demonstrate issue -
AndyMaleh (Andy Maleh)
, 11/30/2019 03:16 AM
class
Person
attr_accessor
:first_name
attr_accessor
:last_name
def
name
"
#{
self
.
last_name
}
,
#{
self
.
first_name
}
"
end
end
person
=
Person
.
new
person
.
first_name
=
'Josh'
person
.
last_name
=
'McGibbon'
trace
=
TracePoint
.
new
(
:call
)
do
|
tp
|
p
[
tp
.
path
,
tp
.
lineno
,
tp
.
defined_class
,
tp
.
event
,
tp
.
method_id
]
end
trace
.
enable
person
.
name
trace
.
disable
class
Person
attr_writer
:first_name
attr_writer
:last_name
def
name
"
#{
self
.
last_name
}
,
#{
self
.
first_name
}
"
end
def
first_name
@first_name
end
def
last_name
@last_name
end
end
person
=
Person
.
new
person
.
first_name
=
'Josh'
person
.
last_name
=
'McGibbon'
trace
=
TracePoint
.
new
(
:call
)
do
|
tp
|
p
[
tp
.
path
,
tp
.
lineno
,
tp
.
defined_class
,
tp
.
event
,
tp
.
method_id
]
end
trace
.
enable
person
.
name
trace
.
disable
« Previous
1
2
Next »
(1-1/2)
Loading...