Is there an easy way to repeat a previous command in Ruby irb?
I wish to have something like using exclamation mark (!) in Unix.
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
then you can use
replat_last_irbin you irb console to run last input.IRB.CurrentContext.io is like this below:
this Object save irb all io info, and with a line method to get every line you input.
so, we can use eval to repeat last input.