irb Questions

5

Solved

If I define a method in IRB, is there any way to review its source later in the session? > def my_method > puts "hi" > end Several screens of output later I'd like to be able to write s...
Glottis asked 25/8, 2011 at 12:15

6

Solved

I'd like to navigate around the filesystem in IRB and have the prompt change to reflect the current working directory, but I can't figure out how to make the prompt update after each command. Ultim...
Slackjawed asked 20/5, 2011 at 17:21

4

Since: irb --help Usage: irb.rb [options] [programfile] [arguments] I know I can pass arguments to ARGV if I include a programfile eg: irb test.rb A B C where test.irb is simply "p ARGV"...
Padegs asked 20/1, 2011 at 16:6

4

Solved

Rails has useful command rails console, which downloads all necessary data and then we can interact with rails project in irb. Is there the same technique for Ruby project (built on Ruby language)?...
Sprig asked 24/3, 2011 at 20:8

5

Solved

Say I have a file named test1.rb with the following code: my_array = [1, 2, 3, 4 5] Then I run irb and get an irb prompt and run "require 'test1'. At this point I am expecting to be able to acce...
Braziel asked 25/9, 2010 at 12:19

6

Solved

Here's what I've tried: 1. gem install awesome_print 2. echo "require 'ap'" >> ~/.irbrc 3. chmod u+x ~/.irbrc 4. script/console 5. ap { :test => 'value' } Result: NameError: undefined...
Volute asked 24/4, 2010 at 10:1

4

Solved

I've recently started using Ruby 3 more and it seems the home key (to take me to the beginning of the line) the end key (end of the line) and ctrl-u (clear the line) aren't working. I'm running Arc...
Xylography asked 10/6, 2022 at 8:28

3

I create a rails project by rails new foo, then cd foo, and run rails c. Then I got message like this. DL is deprecated, please use Fiddle Loading development environment (Rails 4.0.2) Switch to ...
Kuvasz asked 10/5, 2014 at 7:40

7

Solved

in ~/.irbrc i have these lines: require 'irb/ext/save-history' #History configuration IRB.conf[:SAVE_HISTORY] = 100 IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" and yet when i ru...
Steamheated asked 14/1, 2010 at 17:1

3

Solved

The latest version of irb introduced an autocomplete that is quite buggy and I don't generally like to be distracted by an autocomplete, any idea how I can disable it? Related question: How to dis...
Shudder asked 28/12, 2021 at 9:24

7

Solved

I was testing some DB entries in our production server in Rails Console where almost all the commands were producing a huge number of lines of output and causing the ssh channel to hang. Is there a...
Cyma asked 13/1, 2011 at 9:59

3

Solved

A follow up to Disable irb autocomplete I would like to disable IRB on Heroku, e.g. having an .irbrc with: IRB.conf[:USE_AUTOCOMPLETE] = false In the home directory of my heroku dyno/server How ca...
Salver asked 19/1, 2022 at 9:28

5

Solved

Basically, I'm typing along just fine in terminal, using IRB to run ruby commands: 2.0.0-p0 :014 > bank_account.withdraw(2222) => -1222 But sometimes I accidentally miss out a quotation ...
Kakaaba asked 29/3, 2013 at 14:35

4

Solved

I've got a small program meant to be run in IRB. It ultimately outputs something that looks like an array, though technically isn't an array. (The class inherits from array.) The problem is, when I...
Dimitri asked 13/7, 2012 at 3:51

2

Solved

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 sessi...
Exhale asked 15/9, 2020 at 0:1

4

I'm very happy to be using the most recent ruby 3.0; as well as having access to the updated command-line interpreter which does syntax highlighting and coloring. However, the colors are a bit hard...
Briarwood asked 2/3, 2021 at 21:22

6

Solved

I "set editing-mode vi" in my .inputrc on my Mac OS system, which allows vi editing in IRB. When I'm using a RVM Ruby, the IRB sessions don't process this directive. Does anyone know a solution? ...
Yukyukaghir asked 9/7, 2011 at 16:50

3

I want to reload a file in irb. The file, prime.rb, contains the following code: def is_prime? num (2..num-1).each do |div_by| if num % div_by == 0 return false end end true end I can use ...
Hookah asked 13/5, 2019 at 12:48

9

Solved

I've been just going through PragProg Continuous Testing With Ruby, where they talk about invoking IRB in context of current class to inspect the code manually. However, they quote that if you inv...
Potency asked 15/11, 2010 at 23:17

4

Solved

When I paste the following text into IRB or PRY running under ruby-enterprise-2011.03, it takes 13 seconds. # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incidi...
Ascanius asked 3/9, 2011 at 22:12

4

Solved

If I, say, loop through all the instances of a given model and output something from each, at the end, irb will still print the entire object. If the object ends up taking hundreds of lines, it'l...
Spine asked 8/11, 2012 at 7:16

3

Solved

Is it possible to escape that effect when assigning to a value: irb(main):584:0>a = true =>true irb(main):584:0> I have a code that has lots of assignings and when I am trying to test i...
Basque asked 22/12, 2013 at 17:17

2

Solved

When using irb or rails console, I sometimes get stuck. For example, I forget a closing quote, so when I press enter, it's still waiting on that. Sometimes I can get out of this (by suppyling the ...
Hereford asked 2/12, 2011 at 14:54

7

Solved

Previously I was using Ruby 1.8 and my irb command prompt used to look like this: Air ~: irb >> a = 1 => 1 >> b = 2 => 2 >> a + b => 3 I installed rvm (and Ruby 1.9.2)...
Lexicographer asked 18/5, 2011 at 2:37

5

Solved

I spent the last year doing Ruby development, and during that time I discovered irb, which makes running little "code experiments" easy and fun. I've recently switched teams and am now do...
Marinemarinelli asked 20/5, 2011 at 18:42

© 2022 - 2024 — McMap. All rights reserved.