Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
今天疯狂的想。
有什么方法可以获取执行代码的行号吗?
Logger.info "I was run on line #{get_line_number}"
您可以使用__LINE__变量。另请参阅此https://stackoverflow.com/a/2496240/100466答案。
__LINE__