/tracepoint_equal_integer.rb Secret
Last active
November 14, 2018 15:58
tracepoint_equal_integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x=[1,2,3]; | |
TracePoint.new(:call, :c_call){ |tp| | |
puts "#{tp.defined_class} #{tp.method_id} #{tp.path}:#{tp.lineno}" | |
}.enable { x.index(2) } | |
# Array index (irb):4 | |
# => 1 | |
x=[1,2,3]; | |
class Integer; def ==(_); super; end; end | |
# => :== | |
TracePoint.new(:call, :c_call){ |tp| | |
puts "#{tp.defined_class} #{tp.method_id} #{tp.path}:#{tp.lineno}" | |
}.enable { x.index(2) } | |
# Array index (irb):9 | |
# Integer == (irb):5 | |
# Comparable == (irb):5 | |
# Integer <=> (irb):5 | |
# => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment