How can I set my Pry prompt to be the current timestamp?
-
24-12-2019 - |
Question
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)?
Solution
You need to use prompt
not prompt_name
Pry.config.prompt = Proc.new { |output, value| Time.now.to_s[0..-6] }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow