1

I'm using iruby on Jupyter. In python kernel (ipython), one can input a string from notebook by calling input() function.

Is it possible to achieve the same thing in iruby?

Yuki Inoue
  • 3,569
  • 5
  • 34
  • 53

2 Answers2

2

If you use Jupyter Notebook, try IRuby.input

https://github.com/SciRuby/iruby/tree/master/lib/iruby/input

But this input box may not work in Jupyter Lab.

kojix2
  • 806
  • 7
  • 18
2

Simple text input is done with IRuby.input:

name = IRuby.input 'Enter your name'

Multiple fields of input is done with IRuby.form:

result = IRuby.form do 
  input :username
  button
end

It returns a Hash with the input field names as labels.

Gerhard
  • 6,850
  • 8
  • 51
  • 81