How to peel off in Ruby irb?

Possible duplicate:
Is there a way to get out of the freezing state in the IRB?

I am using IRB. When I encode, I noticed that I am "stuck" when the line ends with " / ":

 irb(main):057:0/ 

When this happens, I canโ€™t do anything, I canโ€™t go out, identify things, etc. It continues to return to lines ending with " / ".

But, when the line ends like this:

 irb(main):056:0> 

everything is working fine. I can go out, if necessary, define something, etc.

How can I peel off when the line ends with " / "?

+4
source share
3 answers

You can press ctrl + c and then return to return an IRB prompt.

+7
source

When you get stuck in an IRB, this is usually due to an unsurpassed closing delimiter, such as a single quote that does not match a double quote.

For this particular question, this is because it is in a Regexp object, the separator of which is the "/" that you pressed. This is identical in action to the fact that the open quote does not close. Once you finish the slash to close Regexp, you will find yourself in the next prompt, and you will see some return from the IRB on the line to your cursor location. Thus, it is advisable to simply close the separator.

Perhaps this can only be a fishing expedition, you should ignore the return at the end of the line instead, and when you should use the backslash ('\'), did you use the slash?

Control-C looks heavy as it tries to send an interrupt. Control-D is the EOD character or end of the data * and therefore, as a rule, the IRB knows that you have entered data in a string (or stream).

This works not only with IRB, but can take you out of rather difficult places without interrupting the application that works. Allows you to have an elegant exit or even continue to work with the program and correct your error, for example, sometimes in IRB.

Screenshot of situation where missing one of the parenthesis are missing.

Of course, if that doesn't work, try control-c , it will most likely be heavy enough to be missed.


* : historically , EOT or "End of tape" or "End of transfer". Maybe itโ€™s just that I mnemonically treat โ€œdataโ€ as an input stream.

+5
source

This is caused by pressing Enter when the line ends in an unused regular expression. You can use Ctrl + C, as alex said, or fill in regexp, ending it with another slash (or, if you started the regular expression with %{ , end it with } , etc.).

+2
source

Source: https://habr.com/ru/post/1444476/


All Articles