How can I set my Pry prompt to be the current timestamp?

谁都会走 提交于 2019-12-24 11:37:00

问题


When I put the following line into ~/.pryrc it doesn't work as expected:

Pry.config.prompt_name = Time.now.to_s

Every prompt is equal to the time that Pry was launched.

How do I update the prompt with the current timestamp, each time the prompt is displayed (after each call)?


回答1:


You need to use prompt not prompt_name

Pry.config.prompt = Proc.new { |output, value| Time.now.to_s[0..-6] } 


来源:https://stackoverflow.com/questions/22084481/how-can-i-set-my-pry-prompt-to-be-the-current-timestamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!