Questions tagged [irb]

Interactive Ruby (IRB) is a shell for programming in Ruby. The program can be launched from a command prompt and allows the execution of Ruby commands line by line.

Interactive Ruby Shell (IRB) is a shell for programming in Ruby. The program can be launched from a command prompt and allows the execution of Ruby commands line by line. It features command history, line editing capabilities, and job control, and is able to communicate directly as a shell script over the Internet and interact with a live server. It was developed by Keiju Ishitsuka.

772 questions
4
votes
4 answers

Change Font dynamically in console

Is there a proper plugin or a class to change font size, font type and decoration within a common output console? You can change terminal's font by going into preferences but that is not what I'm looking for here. I want to be able to change font…
Bhushan Lodha
  • 6,824
  • 7
  • 62
  • 100
3
votes
1 answer

Why do I get "stack level too deep" from method_missing in irb 1.9.3?

Scenario: -bash-3.2$ irb -f ruby-1.9.3-p0 :001 > @v = {} => {} ruby-1.9.3-p0 :002 > def method_missing(sym, *args); @v[sym]; end => nil ruby-1.9.3-p0 :003 > a (irb):2: stack level too deep (SystemStackError) -bash-3.2$ I ran with -f to avoid…
Kelvin
  • 20,119
  • 3
  • 60
  • 68
3
votes
2 answers

How to make and store methods and classes in irb?

I'm studying Ruby. I know that Ruby was heavily influenced by Smalltalk. Smalltalk IDEs offer image based persistence, which means one can add methods and classes from within the running image. Is the same possible in Ruby's irb?
eonil
  • 83,476
  • 81
  • 317
  • 516
3
votes
4 answers

"each" function implementation using 'for each' in ruby

I have been learning ruby and interested in knowing how 'each' is implemented in the array class. I saw one documentation here and it looks like this is how 'each' is written; # within class Array... def each for each element yield(element) …
Benny Tjia
  • 4,853
  • 10
  • 39
  • 48
3
votes
2 answers

irb loading wrong ruby and gem path, using rbenv

I started using rbenv for ruby version management and I'm finding that irb not loading the correct ruby version and gem version. Here are the details. irb Gem.path says: `>> Gem.path => ["/Users/Air/.gem/ruby/1.8", "/Library/Ruby/Gems/1.8",…
alenm
  • 1,013
  • 3
  • 15
  • 34
3
votes
2 answers

Where Can I Find Current Adobe Image Format Specifications? "Clipping Paths"

This is in regards to Adobe's Image Resource Blocks(IRB), that they store in TIFF, PSD, JPEG Formats. It's also called "8BIM", This standard was released with Adobe's Photoshop 3 (November 1994). IRB contains information on color profiles and…
Elijah Glover
  • 1,968
  • 2
  • 14
  • 21
3
votes
1 answer

how add alias to .irbrc?

I want add alias to my .irbrc similary like alias q exit (work). But I want to run some command, for example alias cleandb="DatabaseCleaner.clean" (don't work). How execute this?
Mikhail Grishko
  • 4,258
  • 3
  • 22
  • 21
3
votes
1 answer

Method called on an object when displayed on the console in Ruby

I am willing to call a method when trying to display an object, but I don't find which method is used, for example: [41] pry(main)> u => {"id"=>3} [42] pry(main)> u.inspect => "#" [43] pry(main)> u.to_s => "#" [44] pry(main)>…
jrichardlai
  • 3,317
  • 4
  • 21
  • 24
3
votes
2 answers

Readline.completion_append_character doesn't work for irb

I built my ruby like so: brew install readline rvm install ruby-1.9.2-head -C --with-readline-dir=/usr/local/Cellar/readline/6.2.1/ When I do tab completion it appends a space after everything. I found in the docs that there's a variable called…
chrismealy
  • 4,830
  • 2
  • 23
  • 24
3
votes
1 answer

Ruby / IRB: set instance variable to private or otherwise invisible?

In Ruby, when I do something like this: class Foo ... def initialize( var ) @var = var end ... end Then if I return a foo in console I get this object representation: # Sometimes I have an…
Andrew
  • 42,517
  • 51
  • 181
  • 281
3
votes
4 answers

ruby irb on windows using gitbash shell - can't use arrow keys to modify command input?

when I do rails console my git bash shell permits me to use up arrow to recall commands, and use left/right arrows to modify the text I'm entering when I run irb the shell ignores backspace and arrow keys I'm not sure why the arrow keys would work…
jpw
  • 18,697
  • 25
  • 111
  • 187
3
votes
2 answers

Why is the RubyMine console failing to start?

I'm running the latest RubyMine, 2020.1.1 (Build #RM-201.7223.94), Ruby 2.7 and Rails 6.0.2.2. When I try to start a Rails console, I get this error: C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
3
votes
1 answer

Ruby puts not outputting in real time

I've started some problems on Project Euler. One of the questions: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I have some code written up...and it works: class Integer def…
Jordan Arsenault
  • 7,100
  • 8
  • 53
  • 96
3
votes
2 answers

ruby void value expression

why I am getting void value expression error? Code [return 1] And error from rib: SyntaxError ((irb):3: void value expression) same situation here: def a [ return 1 if true 2 ] end
mbronek7
  • 79
  • 1
  • 5
3
votes
1 answer

why irb plugins not loaded in rails console session?

I have installed both awsome print & hirb irb plugins to Ruby 1.9.2 through rvm. I can able to access it from irb session. But when i tried from rails console, i got the error ruby-1.9.2-p180 :001 > require "hirb" LoadError: no such file to load --…
RameshVel
  • 64,778
  • 30
  • 169
  • 213