How can I set my Pry prompt to be the current time

2019-08-11 09:35发布

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条回答
女痞
2楼-- · 2019-08-11 09:53

You need to use prompt not prompt_name

Pry.config.prompt = Proc.new { |output, value| Time.now.to_s[0..-6] } 
查看更多
登录 后发表回答