Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruboto IRB console doesn't accept input #32

Open
ChaosCat opened this issue Dec 23, 2015 · 10 comments
Open

Ruboto IRB console doesn't accept input #32

ChaosCat opened this issue Dec 23, 2015 · 10 comments
Labels
Milestone

Comments

@ChaosCat
Copy link

When launching a script with a line such as
'input = gets' the console just ignores the line as if it is an empty variable declaration, no error/message is thrown whatsoever.

@ChaosCat ChaosCat changed the title Ruboto IRB console doesn't accept Ruboto IRB console doesn't accept input Dec 23, 2015
@donv donv added the bug label Dec 23, 2015
@donv donv added this to the 0.8 milestone Dec 23, 2015
@ChaosCat
Copy link
Author

I would like to try to solve the problem, can anyone please tell me where to start or how to approach it?

@donv
Copy link
Member

donv commented Dec 23, 2015

@rscottm can you help @ChaosCat ? It would be great to have another committer on Ruboto-IRB.

@ChaosCat you should start by actually describing what you would like to happen.

@donv donv removed the help wanted label Dec 23, 2015
@ChaosCat
Copy link
Author

Right now this is the result of trying to store input in a variable:

#Ruboto IRB
>>input = gets
=>nil
>>puts input
=>
nil

I want the IRB to simply wait for input and only then continue.
Probably like so:

#Ruboto IRB
>>input = gets
hey
=>nil
>>puts input
=> hey
nil

@donv
Copy link
Member

donv commented Dec 24, 2015

OK, so you basically want STDIN to read from the Ruboto IRB command line, right?

@ChaosCat
Copy link
Author

Basically yeah, what causes the code right now to skip the command? And if I want to add the feature where should I start?

@donv
Copy link
Member

donv commented Dec 24, 2015

The Ruboto IRB command line is not the console (STDIN). It is just a regular UI Text component. You need to change the behaviour of either #gets or STDIN to read input from either the Ruboto IRB input field or maybe a popup input dialog.

@ChaosCat
Copy link
Author

I think I will try to change the #gets behavior to read from the input field and, what file is the file that dictates each method's behavior? I still don't know very well how the Ruboto repository is built and what folders contain which files I couldn't find it at src\folder of neither IRB nor Ruboto repository.

@donv
Copy link
Member

donv commented Dec 25, 2015

The behaviour of #gets is defined by the Ruby implementation, that is JRuby. We should not change that, but rather override it like you can in Ruby. I think the method to override is Kernel#gets.

@MrSchism
Copy link

MrSchism commented Apr 7, 2016

Any progress on this? It's not major, as I can always just define the input on the script and just rerun. Either way, it's be nice

@bhundu07
Copy link

[Running editor script (untitled.rb)]
=> nil
[Running editor script (untitled.rb)]
=> nil
ma
=> NameError: undefined local variable or method `ma' for main:Object
(root) at eval:1
nil

i have the same problem but mine display nameerror. how do i solve that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants