trace = TracePoint.new do |tp|
p [tp.lineno, tp.event, tp.defined_class,tp.method_id]
end
trace.enable do
while gets
# when you type start in your console, 11 will be output.
print 11 if /start/../end/
end
end

Let me run this code, to show you my above code as a proof and also the Ruby Flip-Flop feature :