gets - irb

43 views
Skip to first unread message

Julian Kallenborn

unread,
Jan 12, 2015, 4:41:16 AM1/12/15
to rub...@googlegroups.com
I am very new and want to go ahead with learning on my device. In IRB i don't seem to use gets or what is that? Thank You!!

Scott Moyer

unread,
Jan 12, 2015, 4:39:02 PM1/12/15
to rub...@googlegroups.com
Hi Julian,

You're right. IRB the app is really just a wrapper around JRuby to execute lines of code or scripts. It prints the output to an Android TextView. While it takes its name from Ruby's irb, it is not fully hooked up (e.g., you can't use gets to get input). Another example of difference is that each bit of code must be full executable in IRB. You can put in a line like:

    my_list.each do |i|

Normal Ruby irb would know that you're not done yet, and wait for an "end" to your code thought. IRB the app will just give you an error.

It might be possible to get IRB the app hooked up more like irb, but we've never gone down that path. It would be an interesting project if someone wanted to take it on.

-- Scott 

On Mon, Jan 12, 2015 at 4:41 AM, Julian Kallenborn <julia...@gmail.com> wrote:
I am very new and want to go ahead with learning on my device. In IRB i don't seem to use gets or what is that? Thank You!!

--
You received this message because you are subscribed to the Google Groups "Ruboto (JRuby on Android)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruboto+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Lau

unread,
Jan 23, 2015, 3:44:58 PM1/23/15
to rub...@googlegroups.com
Hi Scott,

As a beginner - is there any way to easily get user input from Ruby IRB?

Thanks,
David

Scott Moyer

unread,
Jan 25, 2015, 12:38:09 AM1/25/15
to rub...@googlegroups.com
Ruboto makes it pretty easy to create a quick Activity with a widget or two (maybe a EditText and a Button). That's what I do.
Reply all
Reply to author
Forward
0 new messages