Ruby Coding Editor for Technical Interviews

Running MRI 3.0 - Autocomplete is enabled

The Ruby environment is augmented with a few REPL features as well as some helpful libraries.

The REPL uses Pry to provide a REPL with history, highlighting, and autocomplete. Additionally, whenever you run scripts in CoderPad’s editor, the REPL will deposit you at the exact line and state of any exceptions. If there were no errors, you will have a REPL with access to all of the variables and functions defined in your script.

The libraries included and ready for requireing are:

  • minitest is a simple framework suitable for a variety of testing needs, like unit testing, specs, and mocking. To run your tests, require minitest/autorun like so:
require 'minitest/autorun' class Dog def talk! 'BARK' end end describe Dog do it 'must bark when spoken to' do Dog.new.talk!.must_equal 'BARK' end end
Code language: Ruby (ruby)
  • RSpec is another very popular library for testing in Ruby. You trigger RSpec in CoderPad by requiring rspec/autorun. The equivalent of the previous example in RSpec would be:
require 'rspec/autorun' class Dog def talk! 'BARK' end end RSpec.describe Dog do it 'barks when spoken to' do expect(Dog.new.talk!).to eq('BARK') end end
Code language: Ruby (ruby)
  • algorithms is a gem with some useful data structure implementations.
  • ActiveSupport extends the Ruby language with a lot of useful features built up by the Rails team over the years.

Try Our Ruby Editor