All Questions
Tagged with read-eval-print-loop ruby
40 questions
1
vote
1
answer
138
views
Make interactive ruby REPL display results for consecutive commands, not only the last?
If I run this
a = "hello"
b = "world"
a
b
in ruby
irb(main):007> a = "hello"
=> "hello"
irb(main):008> b = "world"
=> "world"
...
0
votes
1
answer
46
views
What is the traceback/local jumpback error in irb repl when writing multiline code?
I am a newbie, forgive if this is an obvious question but does anyone know why my irb repl isn't able to do multilines? I have tried lots of different if statements (copied from course notes that I am ...
6
votes
3
answers
1k
views
How can I add a new line in Ruby 2.7+ IRB multiline edit mode?
Ruby 2.7 introduced an update to IRB that allows multiline editing. How can I add a new line into a multiline method to inject code between two previous statements?
E.g.
2.7.1 :019 > while session =...
-2
votes
1
answer
274
views
Does exist a similar REPL for JavaScript in the browser, like Pry for Ruby development?
I experienced that the Pry introspection gem https://github.com/pry/pry for Ruby makes the program develompent easier a lot: one can stop the program at a given point with the statement "binding.pry", ...
1
vote
1
answer
252
views
Which is correct REPL or command-line?
when i write method missing in Object class i'm getting the output different in each interface.
the code is
class Object
def method_missing(hgh)
puts self
end
end
when i use REPL like irb, i ...
2
votes
1
answer
1k
views
What's the difference between binding.pry and Pry.start?
require 'pry'
var = "variable"
class Gnar
def self.gar
@var = "lar!"
# binding.pry
# Pry.start(binding)
# Pry.start
end
end
Gnar.gar
When I uncomment binding....
0
votes
0
answers
414
views
How can I debug a dynamically defined method with Ruby? (method created within repl session)
Is it possible to debug dynamically defined method in Ruby? If so, how can I achieve it?
So I opened a new Pry session and first tried it like this:
require "byebug"
def hello(x)
byebug
x += 1
...
0
votes
1
answer
69
views
Append Kernel.local_variables to scope of binding
I've made a rudimentary REPL for a software which has the ability to run ruby scripts. I want to be able to pass the variables from the previous scope to the REPL on launch, so I can easily debug my ...
1
vote
1
answer
320
views
Why does a Ruby toplevel assignment method fail to assign instance variables in the REPL?
Setter Works Inside a Class; Fails in REPL Top-Level
In a related question, I was trying to understand why an assignment method was returning an unexpected value, and learned that this is a ...
1
vote
1
answer
205
views
How to provide an online ruby REPL?
On a site like www.codewars.com, one can run ruby in a sort of sandbox, almost identical to IRB.
How does this actually work?
If the submitted code is eval()d, what's preventing me from submitting ...
0
votes
2
answers
246
views
How to create Ruby repl in the browser
Hi thanks for taking a look at my question. I'm trying to create a site with a Sinatra server that will allow users to run ruby code in the browser similar to what you see with repl.it, code academy, ...
1
vote
3
answers
2k
views
Using RSpec to Test Console Application Interaction
I have several console applications that have a read, evaluate, print, loop (REPL) using readline that I would like to create tests for using RSpec if possible. I've read about mock classes, but I don'...
0
votes
2
answers
1k
views
Rails REPL that is more than irb/pry but less than rails console
I frequently want to try out small code snippets, often much smaller than classes, and even functions, just to make sure it works by itself so I don't need to test it by running a bunch of scripts, ...
1
vote
1
answer
94
views
Executing statements with leading periods in pry
Pry interprets a command with a leading . as a system command and passes it to shell. However this prevents me from executing blocks of code with lines that have leading ., which are very frequent in ...
1
vote
1
answer
115
views
Programmatically Loading Libraries with a Ruby REPL
I've been trying to get load project libraries in a script, then start either IRB or ripl to allow the user to have quick interaction with project libraries. I've succeeded in doing this.
My issue is ...